Level Changes

Added in additional layer to previous levels for Spikes.
This commit is contained in:
ESloman 2016-02-22 14:17:46 +00:00
parent 556f5fae30
commit 9f2627947c
7 changed files with 53 additions and 19 deletions

View file

@ -11,15 +11,18 @@ import static com.game.misc.Vars.PPM;
/**
* Created by Elliot on 22/02/2016.
*/
public class Spike extends Base {
public Spike(World world, Vector2 pos, Vector2 size, Colours curColour, short categoryBits, short maskBits) {
public Spike(World world, Vector2 pos, Vector2 size, Colours curColour, short categoryBits) {
super(world, pos, size, "STATIC", curColour);
body = Box2dUtils.makeBody(world,
BodyDef.BodyType.StaticBody,
pos
);
short maskBits = 0;
Box2dUtils.makePolygon(body, size, "", false, categoryBits, maskBits);
Box2dUtils.makeChain(body,
new Vector2[]{

View file

@ -322,7 +322,7 @@ public class Play extends AbstractScreen {
if(cell == null) { continue; }
if(cell.getTile() == null) { continue; }
if(cell.getTile().getId() == 0) { spikes.add(new Spike(world, new Vector2((col + 0.5f) * tileSize.x, (row + 0.5f) * tileSize.y), new Vector2(tileSize.x, tileSize.y), Base.Colours.RED, Vars.BIT_RED, Vars.BIT_PLAYER)); }
if(cell.getTile().getId() == 0) { spikes.add(new Spike(world, new Vector2((col + 0.5f) * tileSize.x, (row + 0.5f) * tileSize.y), new Vector2(tileSize.x, tileSize.y), Base.Colours.RED, Vars.BIT_RED)); }
}
}
}
@ -520,6 +520,15 @@ public class Play extends AbstractScreen {
return;
}
if(fa.getUserData().equals("PLAYER") && fb.getUserData().equals("SPIKES") ||
fb.getUserData().equals("PLAYER") && fa.getUserData().equals("SPIKES"))
{
isEnd = true;
isSuccess = false;
System.out.println("Failure");
return;
}
}
@Override