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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="50" height="8" tilewidth="64" tileheight="64" nextobjectid="46"> <map version="1.0" orientation="orthogonal" renderorder="right-down" width="50" height="8" tilewidth="64" tileheight="64" nextobjectid="47">
<tileset firstgid="1" name="platformSet" tilewidth="64" tileheight="64" tilecount="3" columns="3"> <tileset firstgid="1" name="platformSet" tilewidth="64" tileheight="64" tilecount="3" columns="3">
<image source="../spritesheets/platformSet.png" width="192" height="64"/> <image source="../spritesheets/platformSet.png" width="192" height="64"/>
</tileset> </tileset>
@ -32,9 +32,9 @@
<polyline points="0,0 128,0 128,512 0,512 0,0"/> <polyline points="0,0 128,0 128,512 0,512 0,0"/>
</object> </object>
</objectgroup> </objectgroup>
<objectgroup name="SPIKES"> <layer name="SPIKES" width="50" height="8">
<object id="41" gid="5" x="1344" y="256" width="64" height="64"/> <data encoding="base64" compression="zlib">
<object id="44" gid="5" x="1728" y="256" width="64" height="64"/> eJxjYBgFo2BoAFYSxUfB0AOjcTm0AAAyAAAQ
<object id="45" gid="5" x="2688" y="384" width="64" height="64"/> </data>
</objectgroup> </layer>
</map> </map>

View file

@ -6,9 +6,12 @@
<tileset firstgid="4" name="player" tilewidth="64" tileheight="64" tilecount="1" columns="1"> <tileset firstgid="4" name="player" tilewidth="64" tileheight="64" tilecount="1" columns="1">
<image source="../textures/player_red.png" width="64" height="64"/> <image source="../textures/player_red.png" width="64" height="64"/>
</tileset> </tileset>
<tileset firstgid="5" name="spikes" tilewidth="64" tileheight="64" tilecount="1" columns="1">
<image source="../textures/spikes.png" width="64" height="64"/>
</tileset>
<layer name="PLATFORM" width="50" height="8"> <layer name="PLATFORM" width="50" height="8">
<data encoding="base64" compression="zlib"> <data encoding="base64" compression="zlib">
eJxjYBgF2AAjFA8FwISE0cFg9gcjA373MWLB1AC4wopUwIyEKQFMDNjjENlcQuGA7A5GPGbispdUwMxAPf+TAmiRHkYB+QAA8XAAVA== eJxjYBgFQx0wIeGhBBiRMCF5fOpIBdQKK2YkTAlgYsAeh8jmEgoHZHcw4jETl72kAmYG6vmfFECL9DAKyAcA3mgAUA==
</data> </data>
</layer> </layer>
<objectgroup name="PLAYER"> <objectgroup name="PLAYER">
@ -29,4 +32,9 @@
<polyline points="0,0 0,640 128,640 128,0 0,0"/> <polyline points="0,0 0,640 128,640 128,0 0,0"/>
</object> </object>
</objectgroup> </objectgroup>
<layer name="SPIKES" width="50" height="8">
<data encoding="base64" compression="zlib">
eJxjYBgFwxmwQvFIB8SGwWhYjYJRQDwAAFKUABU=
</data>
</layer>
</map> </map>

View file

@ -6,6 +6,9 @@
<tileset firstgid="4" name="player" tilewidth="64" tileheight="64" tilecount="1" columns="1"> <tileset firstgid="4" name="player" tilewidth="64" tileheight="64" tilecount="1" columns="1">
<image source="../textures/player_red.png" width="64" height="64"/> <image source="../textures/player_red.png" width="64" height="64"/>
</tileset> </tileset>
<tileset firstgid="5" name="spikes" tilewidth="64" tileheight="64" tilecount="1" columns="1">
<image source="../textures/spikes.png" width="64" height="64"/>
</tileset>
<layer name="PLATFORM" width="50" height="8"> <layer name="PLATFORM" width="50" height="8">
<data encoding="base64" compression="zlib"> <data encoding="base64" compression="zlib">
eJxjYBgFlAJmKKYGYETC2OxAt4cJCRNSj24uLr3DHSCHAylhOtBgsLqLWEBttzNiwcj2wOzClg/Q3UNqvhsFEAAAL3cAZA== eJxjYBgFlAJmKKYGYETC2OxAt4cJCRNSj24uLr3DHSCHAylhOtBgsLqLWEBttzNiwcj2wOzClg/Q3UNqvhsFEAAAL3cAZA==
@ -29,4 +32,9 @@
<polyline points="0,0 0,640 128,640 128,0 0,0"/> <polyline points="0,0 0,640 128,640 128,0 0,0"/>
</object> </object>
</objectgroup> </objectgroup>
<layer name="SPIKES" width="50" height="8">
<data encoding="base64" compression="zlib">
eJxjYBj+gJUG6kk1cxQMLBiNr1EwCqgPAGTIABU=
</data>
</layer>
</map> </map>

View file

@ -6,6 +6,9 @@
<tileset firstgid="4" name="player" tilewidth="64" tileheight="64" tilecount="1" columns="1"> <tileset firstgid="4" name="player" tilewidth="64" tileheight="64" tilecount="1" columns="1">
<image source="../textures/player_red.png" width="64" height="64"/> <image source="../textures/player_red.png" width="64" height="64"/>
</tileset> </tileset>
<tileset firstgid="5" name="spikes" tilewidth="64" tileheight="64" tilecount="1" columns="1">
<image source="../textures/spikes.png" width="64" height="64"/>
</tileset>
<layer name="PLATFORM" width="50" height="8"> <layer name="PLATFORM" width="50" height="8">
<data encoding="base64" compression="zlib"> <data encoding="base64" compression="zlib">
eJxjYBgFgwEwAzHjQDuCQsCExGZEwuiAGYoHIyAUB0wMqP4kxjxkM4n1NyVhRIr78JlBql9BAFeckwIGMn1QGnbU8P9AAHLiGgQAlYAAOA== eJxjYBgFgwEwAzHjQDuCQsCExGZEwuiAGYoHIyAUB0wMqP4kxjxkM4n1NyVhRIr78JlBql9BAFeckwIGMn1QGnbU8P9AAHLiGgQAlYAAOA==
@ -30,4 +33,9 @@
</object> </object>
</objectgroup> </objectgroup>
<objectgroup name="SPIKES"/> <objectgroup name="SPIKES"/>
<layer name="SPIKES" width="50" height="8">
<data encoding="base64" compression="zlib">
eJxjYBgFo2AUUBOw0lnfKBhYMJLjDQAnTAAQ
</data>
</layer>
</map> </map>

View file

@ -1,31 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="50" height="8" tilewidth="64" tileheight="64" nextobjectid="31"> <map version="1.0" orientation="orthogonal" renderorder="right-down" width="75" height="8" tilewidth="64" tileheight="64" nextobjectid="34">
<tileset firstgid="1" name="platformSet" tilewidth="64" tileheight="64" tilecount="3" columns="3"> <tileset firstgid="1" name="platformSet" tilewidth="64" tileheight="64" tilecount="3" columns="3">
<image source="../spritesheets/platformSet.png" width="192" height="64"/> <image source="../spritesheets/platformSet.png" width="192" height="64"/>
</tileset> </tileset>
<tileset firstgid="4" name="player" tilewidth="64" tileheight="64" tilecount="1" columns="1"> <tileset firstgid="4" name="player" tilewidth="64" tileheight="64" tilecount="1" columns="1">
<image source="../textures/player_red.png" width="64" height="64"/> <image source="../textures/player_red.png" width="64" height="64"/>
</tileset> </tileset>
<layer name="PLATFORM" width="50" height="8"> <layer name="PLATFORM" width="75" height="8">
<data encoding="base64" compression="zlib"> <data encoding="base64" compression="zlib">
eJxjYBgFo2AUDARgIoAHC2AmgKkB0P2Oyy5GApge4YnL7pEIALMwAF8= eJxjYBgFo2AUDCRgRMPk6h3JgAmKYYAZCY+CUTAKRsFAAABsiAAV
</data> </data>
</layer> </layer>
<objectgroup name="PLAYER"> <objectgroup name="PLAYER">
<object id="24" gid="4" x="0" y="320" width="64" height="64"/> <object id="24" gid="4" x="64" y="128" width="64" height="64"/>
</objectgroup> </objectgroup>
<objectgroup name="BOUNDARY"> <objectgroup name="BOUNDARY">
<object id="23" x="0" y="-192"> <object id="23" x="0" y="-256">
<polyline points="0,0 0,1024 3328,1024 3328,0 0,0"/> <polyline points="0,0 0,1088 4928,1088 4928,0 0,0"/>
</object> </object>
</objectgroup> </objectgroup>
<objectgroup name="FAILBOUNDARY"> <objectgroup name="FAILBOUNDARY">
<object id="29" x="0" y="704"> <object id="33" x="0" y="704" width="4928" height="128"/>
<polyline points="0,0 3328,0 3328,128 0,128 0,0"/>
</object>
</objectgroup> </objectgroup>
<objectgroup name="PASSBOUNDARY"> <objectgroup name="PASSBOUNDARY">
<object id="30" x="3200" y="-192"> <object id="30" x="4800" y="-256">
<polyline points="0,0 0,640 128,640 128,0 0,0"/> <polyline points="0,0 0,640 128,640 128,0 0,0"/>
</object> </object>
</objectgroup> </objectgroup>

View file

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

View file

@ -322,7 +322,7 @@ public class Play extends AbstractScreen {
if(cell == null) { continue; } if(cell == null) { continue; }
if(cell.getTile() == 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; 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 @Override