Added finish block

master
bob 2022-06-06 11:24:46 -04:00
parent 2f5ded58ab
commit 544a069f65
5 changed files with 16 additions and 5 deletions

BIN
img/tiles/boxes/finish.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

View File

@ -6,13 +6,13 @@ sssssssssssssssssd
sssssssssssssssssd 1 1 1 1 1
sssssssssssssssssd 1
sssssssssssssssssd
sssssssssssssssssd
sssssssssssssssssd
sssssssssssssssssd qwe qwe
sssssssssssssssssd asd asd
sssssssssssssssssd qe qe
sssssssssssssssssd ad ! ad
sssssssssssssssssd qwe qwe atwwwrd
sssssssssssssssssd asd asd zxxxxxc
sssssssssssssssssd 1 zxc zxc
sssssssssssssssssd
sssssssssssssssssd qwwwwwwwwe
sssssssssssssssssd qrsssssssstwe
sssssssssssssssssd qwwrssssssssssstwe !!! qwe
sssssssssssssssssd qwwrssssssssssstwe !!! qwe +
ssssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrsssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrstwwwwww3

View File

@ -44,6 +44,7 @@ public class MapReader {
map.add(new SingleTile(x,y, GamePanel.getImage("img/tiles/terrain/grassMiddleLeft.png")));
} else if(file.charAt(i)=='s'){
map.add(new SingleTile(x,y, GamePanel.getImage("img/tiles/terrain/grassCenter.png")));
map.get(map.size()-1).collision = false;
} else if(file.charAt(i)=='d'){
map.add(new SingleTile(x,y, GamePanel.getImage("img/tiles/terrain/grassMiddleRight.png")));
} else if(file.charAt(i)=='z'){
@ -66,6 +67,9 @@ public class MapReader {
} else if(file.charAt(i)=='!'){
enemy.add(new NonPlayer(x, y, GamePanel.slimeSpriteArray, 50, 28));
} else if(file.charAt(i)=='+') {
map.add(new SingleTile(x,y, GamePanel.getImage("img/tiles/boxes/finish.png")));
map.get(map.size()-1).isFinish = true;
}
x+=Tile.length;
}

View File

@ -89,6 +89,10 @@ public class Player extends GenericSprite {
boolean canUpdate = true;
for(int i=0; i<GamePanel.map.size(); i++) {
if(collide(GamePanel.map.get(i),this.x+x,this.y+y)){
if(GamePanel.map.get(i).isFinish){
LevelManager.nextLevel();
return true;
}
canUpdate = false;
break;
}

View File

@ -6,9 +6,12 @@ public class Tile {
public int y;
public boolean collision;
public boolean isFinish;
public int realX;
public static final int length = 35;
public Tile(int x, int y){
isFinish = false;
collision = true;
this.x = x;
this.y = y;