Android Open Source - BlockHopper Levels






From Project

Back to project page BlockHopper.

License

The source code is released under:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION...

If you think the Android project BlockHopper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.blockhopper;
//from w w  w .  j a va 2 s  . c  o m
import org.andengine.util.color.Color;   //800-480

public class Levels {      //changed everything to floats
  public static float width;
  public static float height;


  public static float[][] level_one(){ //[blocks,blocks]...[[px,py,width,height][px,py,width,height].....]
    //2d array each array inside the main array is an array of 4 floats, these determine the location and size of the box
  float[][] bpos = new float[1][4];
  
  
  bpos[0][0] =(width/2) - (width/8) ;//X
  bpos[0][1] =height/2.0f  + height/6.0f;//Y
  bpos[0][2] =width/4.0f;//Width
  bpos[0][3] =height/12.0f;//Height
    return bpos;
  }
  public static float[][] level_two(){ 
    float[][] bpos = new float[3][4];
    bpos[0][0] =  (width/2) + (width/8) ;//X
    bpos[0][1] =  height/2  + height/6;//Y
    bpos[0][2] =  width/8;//Width
    bpos[0][3] =  height/14;//Height
    
    bpos[1][0] =  (width/2) - (width/16) ;//X
    bpos[1][1] =  height - height/14;//Y
    bpos[1][2] =  width/8;//Width
    bpos[1][3] =  height/14;//Height
    
    bpos[2][0] =  (width/2) - (width/4) ;//X
    bpos[2][1] =  height/2  + height/6;//Y
    bpos[2][2] =  width/8;//Width
    bpos[2][3] =  height/14;//Height
  
    return bpos;
  }
  public static float[][] level_three(){   //x
    float[][] bpos = new float[2][4];    //y  
    bpos[0][0] = width/4;        //width  
    bpos[0][1] = height/2 + height/5;  //height  
    bpos[0][2] = width/16;
    bpos[0][3] = height/50;
    
    bpos[1][0] = width/2 + width/10;
    bpos[1][1] = height/2 -height/15;
    bpos[1][2] = width/18;
    bpos[1][3] = height/50;
    
    return bpos;
  }
  public static float[][] level_four(){      
    //x
    //y  
    //width  
    //height
    float[][] bpos = new float[2][4];
    bpos[0][0] = width/2 - width/30;
    bpos[0][1] = height/2 + height/12;
    bpos[0][2] = width/30;
    bpos[0][3] = height/80;
    
    bpos[1][0] = width/2 - width/60 - width/200;
    bpos[1][1] = height/2 +  height/12;
    bpos[1][2] = width/100;
    bpos[1][3] = height/2+ height/12;
    
//    bpos[2][0] = width/2 - width/80;
//    bpos[2][1] = height/2 - height/4;
//    bpos[2][2] = width/40;
//    bpos[2][3] = height/80;
    


    return bpos;
  }
  public static float[][] level_five(){  
    //x
    //y  
    //width  
    //height
    float[][] bpos = new float[2][4];

    bpos[0][0] = width/2 + width/4 - width/30;
    bpos[0][1] = height/2 + height/6;
    bpos[0][2] = width/30;
    bpos[0][3] = height/80;
    
    bpos[1][0] = width/2 - width/4 + width/30;
    bpos[1][1] = height/2 + height/4;//height*(7/16);
    bpos[1][2] = width/30;
    bpos[1][3] = height/80;
    
    return bpos;
  }
  public static float[][] level_six(){  
    //x
    //y  
    //width  
    //height
    float[][] bpos = new float[4][4];
    bpos[0][0] = width/2 - width/5;
    bpos[0][1] = height/2; //- height/12;
    bpos[0][2] = width/30;
    bpos[0][3] = height/80;
    
    bpos[1][0] = width/2 - width/5 +  width/60 - width/200;
    bpos[1][1] = height/2; //- height/12;
    bpos[1][2] = width/100;
    bpos[1][3] = height/2; //+ height/12;
    
    bpos[2][0] = width/2 + width/5;
    bpos[2][1] = height/2; //- height/12;
    bpos[2][2] = width/30;
    bpos[2][3] = height/80;
    
    bpos[3][0] = width/2 +width/5 + width/60 - width/200;
    bpos[3][1] = height/2; //- height/12;
    bpos[3][2] = width/100;
    bpos[3][3] = height/2; //+ height/12;

    return bpos;
  }
  public static float[][] level_seven(){  //lots
    //x
    //y  
    //width  
    //height
    float[][] bpos = new float[8][4];
    bpos[0][0] = width/2 + width/8;
    bpos[0][1] = height/2 -height/8 - width/30;
    bpos[0][2] = width/30;
    bpos[0][3] =  width/30;
    
    bpos[1][0] = width/2 + width/8;
    bpos[1][1] = height - width/30 ;
    bpos[1][2] = width/30;
    bpos[1][3] = width/30;
    
    bpos[2][0] = width/2 + width/8;
    bpos[2][1] = 0;
    bpos[2][2] = width/30;
    bpos[2][3] = width/30;
    
    
    bpos[3][0] = width/2 + width/8;
    bpos[3][1] = height/2 +height/8;
    bpos[3][2] = width/30;
    bpos[3][3] = width/30;
//////////////////////////////////////////    
    bpos[4][0] = width/2 - width/8;
    bpos[4][1] = height/2 -height/8 - width/30;
    bpos[4][2] = width/30;
    bpos[4][3] =  width/30;
    
    bpos[5][0] = width/2 - width/8;
    bpos[5][1] = 0 ;
    bpos[5][2] = width/30;
    bpos[5][3] = width/30;
    
    bpos[6][0] = width/2 - width/8;
    bpos[6][1] = height - width/30;
    bpos[6][2] = width/30;
    bpos[6][3] = width/30;
    
    
    bpos[7][0] = width/2 - width/8;
    bpos[7][1] = height/2 +height/8;
    bpos[7][2] = width/30;
    bpos[7][3] = width/30;

    return bpos;
  }
  public static float[][] level_eight(){  
    //x
    //y  
    //width  
    //height
    float[][] bpos = new float[5][4];
    bpos[0][0] = width/2 -width/80; //middle
    bpos[0][1] = height - height/10;
    bpos[0][2] = width/50;
    bpos[0][3] = height/10;
    
    bpos[1][0] = width/2 + width/6 - width/80; //right 
    bpos[1][1] = height/2 + height/3;
    bpos[1][2] = width/50;
    bpos[1][3] = height/2 - height/3;
    
    bpos[2][0] = width/2 + width/3 -width/80; //far right
    bpos[2][1] = height/2 + height/6;
    bpos[2][2] = width/50;
    bpos[2][3] = height/2;
    
    
    bpos[3][0] = width/2 - width/6 - width/80; //left
    bpos[3][1] = height/2 + height/3;
    bpos[3][2] = width/50;
    bpos[3][3] = height/2 - height/3;
    
    bpos[4][0] = width/2 -width/3 - width/80; //far left
    bpos[4][1] = height/2 + height/6;
    bpos[4][2] = width/50;
    bpos[4][3] = height/2;
      
    return bpos;
  }
  public static float[][] level_nine(){  
    //x
    //y  
    //width  
    //height
    float[][] bpos = new float[2][4];
    bpos[0][0] = width/5;        //width  
    bpos[0][1] = height/2 + height/5;  //height  
    bpos[0][2] = width/90;
    bpos[0][3] = height/50;
    
    bpos[1][0] = width/2 + width/8;
    bpos[1][1] = height/2 -height/15;
    bpos[1][2] = width/100;
    bpos[1][3] = height/50;
    return bpos;
  }
  public static float[][] level_ten(){  
    //x
    //y  
    //width  
    //height
    float[][] bpos = new float[1][4];
    bpos[0][0] = width/2 - width/100;
    bpos[0][1] = height/2 + height/4;
    bpos[0][2] = width/110;
    bpos[0][3] = height/100;
    
    return bpos;
  }
  
  public static Color getblockcolour(float levelcount) { //returns the hardcoded colour for the blocks by level, decimal RGB ( rgb value/255) 
    
    Color c = new Color(1.0f,.5f,.3f);
    if(levelcount==1){
      c = new Color(0.0f,0.0f,.4f);
      
    }
    if(levelcount==2){
      c = new Color(1.0f,0.65882352941176470588235294117647f,0.96862745098039215686274509803922f);
      
    }
    if(levelcount==3){
      c = new Color(1.0f,0.30196078431f,0.0f);
      
    }
    if(levelcount==4){
      c = new Color(0.29411764705882352941176470588235f,0.14117647058823529411764705882353f,0.4078431372549019607843137254902f);
      
    }
    if(levelcount==5){
      c = new Color(0.22352941176470588235294117647059f,0.15294117647058823529411764705882f,0.05098039215686274509803921568627f);
      
    }
    if(levelcount==6){
      c = new Color(0.05490196078431372549019607843137f,0.22352941176470588235294117647059f,0.05098039215686274509803921568627f);
      
    }
    if(levelcount==7){
      c = new Color(0.62352941176470588235294117647059f,0.04705882352941176470588235294118f,0.04705882352941176470588235294118f);
      
    }
    if(levelcount==8){
      c = new Color(1.0f,1.0f,1.0f);
      
    }
    if(levelcount==9){
      c = new Color(0.0f,.2f,.3f);
      
    }
    if(levelcount==10){
      c = new Color(0.07058823529411764705882352941176f,0.96470588235294117647058823529412f,0.54901960784313725490196078431373f);
      
    }
    
    return c;
  }
  public static Color getlevelcolour(int levelcount) {//returns the hardcoded colour for the level background colour, decimal RGB ( rgb value/255) 
    Color c = new Color(Color.BLACK);
    if(levelcount==1){
      c = new Color(0.0f,.835294117647f,1.0f);
      
    }
    if(levelcount==2){
      c = new Color(0.4f,0.0f,0.0f);
      
    }
    if(levelcount==3){
      c = new Color(1.0f,0.98431372549019607843137254901961f,0.4f);
      
    }
    if(levelcount==4){
      c = new Color(0.85098039215686274509803921568627f,0.69019607843137254901960784313725f,0.97647058823529411764705882352941f);
      
    }
    if(levelcount==5){
      c = new Color(0.91372549019607843137254901960784f,0.85882352941176470588235294117647f,0.77254901960784313725490196078431f);
      
    }
    if(levelcount==6){
      c = new Color(0.6039215686274509803921568627451f,0.8078431372549019607843137254902f,0.5960784313725490196078431372549f);
      
    }
    if(levelcount==7){
      c = new Color(0.94117647058823529411764705882353f,0.61176470588235294117647058823529f,0.28235294117647058823529411764706f);
      
    }
    if(levelcount==8){
      c = new Color(0.0f,0.0f,0.0f);
      
    }
    if(levelcount==9){
      c = new Color(0.98823529411764705882352941176471f,0.0f,0.56078431372549019607843137254902f);
      
    }
    if(levelcount==10){
      c = new Color(0.06274509803921568627450980392157f,0.61176470588235294117647058823529f,0.63137254901960784313725490196078f);
      
    }
    
    return c;
  }
  
  
}




Java Source Code List

com.example.blockhopper.BuildConfig.java
com.example.blockhopper.GameScene.java
com.example.blockhopper.HighScores.java
com.example.blockhopper.Levels.java
com.example.blockhopper.MainActivity.java
com.example.blockhopper.MenuScene.java
com.example.blockhopper.SplashScene.java