Skip to content

Commit

Permalink
added plus screen
Browse files Browse the repository at this point in the history
superzap kills pods too now.
  • Loading branch information
awlzac committed Mar 18, 2015
1 parent 6a27044 commit b1393da
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 66 deletions.
128 changes: 97 additions & 31 deletions app/src/main/java/com/bulsy/wbtempest/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class Board {
static final int BOARD_DEPTH = 400;
static final int FIRST_SPIKE_LEVEL = 4; // level at which we first see spikes
static final int MAX_COLS = 40; // max conceivable number of columns
private static final int BASE_EX_FIRE_BPS = 35; // bps chance per tick that we fire an ex at player
public static final int NUMSCREENS = 6; // number of different screen layouts
private static final int BASE_EX_FIRE_BPS = 2000; // bps chance per sec that an ex fires at player
public static final int NUMSCREENS = 10; // number of different screen layouts

private int levnum;
private int exesct;
Expand Down Expand Up @@ -51,7 +51,7 @@ public void init(View v, int levnum) {
continuous = false;
boolean firsttime = true;
int x, y, oldx=0, oldy=0;
exesct = 5 + levnum*2;
exesct = 6 + (int)(1.5*levnum);
exesCanMove = (levnum != 1);
if (levnum < FIRST_SPIKE_LEVEL)
spikespct = (float)0;
Expand Down Expand Up @@ -131,7 +131,65 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
}
break;

case 2: // triangle
case 2: // plus
case 4:
continuous = true;
int colwidth = v.getWidth()/6;
zpull_x=cx;
zpull_y= cy+(int)(colwidth*0.8);
x = oldx = cx-colwidth;
y = oldy = cy - colwidth;
x-= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldx = x;
y+= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldy = y;
y+= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldy = y;
x+= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldx = x;
y+= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldy = y;
x+= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldx = x;
x+= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldx = x;
y-= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldy = y;
x+= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldx = x;
y-= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldy = y;
y-= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldy = y;
x-= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldx = x;
y-= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldy = y;
x-= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldx = x;
x-= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldx = x;
y+= colwidth;
columns.add(new Column(oldx, oldy, x, y));
oldy = y;
break;

case 3: // triangle
continuous = true;
//radius = 320;
ncols = 15;
Expand Down Expand Up @@ -174,7 +232,7 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
}
break;

case 3: // straight, angled V
case 5: // straight, angled V
ncols = 16;
// need a different z-pull for a board using this screen
zpull_x = v.getWidth()/2;
Expand All @@ -199,31 +257,13 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
}
break;

case 4: // straight line
ncols = 14;
// need a different z-pull for a board using this screen
zpull_x = v.getWidth()/2;
zpull_y = v.getHeight() /4;
y = v.getHeight() * 5/7;
for (x = v.getWidth() *1/(ncols+2); x < v.getWidth() * (1+ncols)/(ncols+2); x+= v.getWidth()/(ncols+2)){
if (firsttime){
firsttime = false;
}
else {
Column col = new Column(oldx, oldy, x, y);
columns.add(col);
}
oldx = x;
oldy = y;

}
break;

case 5: // jagged V
case 6: // jagged V
case 8:
zpull_x = v.getWidth()/2;
zpull_y = v.getHeight() /5;
int ycolwidth = 90;
int xcolwidth = ycolwidth *4/5;
int total_cols = 15; // must be ODD
int xcolwidth = (int) Math.floor(v.getWidth()/(total_cols/2 - 1)); // should be enough
int ycolwidth = xcolwidth * 5/4;
int ystart;
x = oldx = cx - (int)(xcolwidth*3.5);
y = oldy = ystart = cy - ycolwidth;
Expand All @@ -246,6 +286,28 @@ else if (levnum < FIRST_SPIKE_LEVEL*2)
columns.add(new Column(oldx, oldy, x, y));
oldy=y;
}

case 7: // straight line
case 9:
ncols = 14;
// need a different z-pull for a board using this screen
zpull_x = v.getWidth()/2;
zpull_y = v.getHeight() /4;
y = v.getHeight() * 5/7;
for (x = v.getWidth() *1/(ncols+1); x < v.getWidth() * (1+ncols)/(ncols+2); x+= v.getWidth()/(ncols+2)){
if (firsttime){
firsttime = false;
}
else {
Column col = new Column(oldx, oldy, x, y);
columns.add(col);
}
oldx = x;
oldy = y;

}
break;

}
}

Expand All @@ -254,7 +316,7 @@ public List<Column> getColumns(){
}

public int getLevelColor(){
if (levnum > NUMSCREENS *2)
if (levnum > NUMSCREENS)
return Color.RED;
return Color.BLUE;
}
Expand All @@ -281,8 +343,12 @@ public int getNumExes(){
return this.exesct;
}

public int getExFireBPS(){
return BASE_EX_FIRE_BPS + levnum/2;
/**
* bps chance per second that we will fire
* @return
*/
public int getExFireBPS(float elapsedTime){
return (int)(elapsedTime * (BASE_EX_FIRE_BPS + levnum*15));
}

public int getNumSpikes(){
Expand Down
19 changes: 16 additions & 3 deletions app/src/main/java/com/bulsy/wbtempest/Ex.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private static enum State {STRAIGHT, JUMPRIGHT1, JUMPLEFT1, JUMPRIGHT2, JUMPLEFT
private static long INIT_JUMPINTERVAL = (long)(PlayScreen.ONESEC_NANOS*2/3);
private static float BOARD_TOP_SPEEDUP_FACTOR = 0.7f;
private static long JUMPINTERVAL_FLYING = (long)(PlayScreen.ONESEC_NANOS/15); //while ex is still flying in the center
private static double INIT_SPEED = 65;
private static double INIT_SPEED = 70;
private int col;
private boolean isPod = false;
private double z = Board.BOARD_DEPTH;
Expand Down Expand Up @@ -78,6 +78,19 @@ public static void release(Ex ex) {
usedExes.add(ex);
}

/**
* return the number of exes actually on the playing board, not just in the spawn area.
* @param exes a list of exes, to filter
* @return
*/
public static int exesOnBoard(List<Ex> exes) {
int obx = 0;
for (Ex ex : exes) {
if (ex.getZ() < Board.BOARD_DEPTH)
obx++;
}
return obx;
}

public void resetZ(int zdepth) {
z = zdepth;
Expand Down Expand Up @@ -121,9 +134,9 @@ public Ex spawn(boolean moveColumn){
* @param crawlerCol
* @param elapsedTime
*/
public void move(int xbound, int crawlerCol, float elapsedTime) {
public void move(int level, int crawlerCol, float elapsedTime) {
if (z > 0)
z -= INIT_SPEED * elapsedTime;
z -= (INIT_SPEED + level) * elapsedTime;
if (z < 0)
z = 0;
if (z > Board.BOARD_DEPTH)
Expand Down
Loading

0 comments on commit b1393da

Please sign in to comment.