Added finish block
parent
2f5ded58ab
commit
544a069f65
Binary file not shown.
After Width: | Height: | Size: 956 B |
|
@ -6,13 +6,13 @@ sssssssssssssssssd
|
||||||
sssssssssssssssssd 1 1 1 1 1
|
sssssssssssssssssd 1 1 1 1 1
|
||||||
sssssssssssssssssd 1
|
sssssssssssssssssd 1
|
||||||
sssssssssssssssssd
|
sssssssssssssssssd
|
||||||
sssssssssssssssssd
|
sssssssssssssssssd qe qe
|
||||||
sssssssssssssssssd
|
sssssssssssssssssd ad ! ad
|
||||||
sssssssssssssssssd qwe qwe
|
sssssssssssssssssd qwe qwe atwwwrd
|
||||||
sssssssssssssssssd asd asd
|
sssssssssssssssssd asd asd zxxxxxc
|
||||||
sssssssssssssssssd 1 zxc zxc
|
sssssssssssssssssd 1 zxc zxc
|
||||||
sssssssssssssssssd
|
sssssssssssssssssd
|
||||||
sssssssssssssssssd qwwwwwwwwe
|
sssssssssssssssssd qwwwwwwwwe
|
||||||
sssssssssssssssssd qrsssssssstwe
|
sssssssssssssssssd qrsssssssstwe
|
||||||
sssssssssssssssssd qwwrssssssssssstwe !!! qwe
|
sssssssssssssssssd qwwrssssssssssstwe !!! qwe +
|
||||||
ssssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrsssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrstwwwwww3
|
ssssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrsssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrstwwwwww3
|
|
@ -44,6 +44,7 @@ public class MapReader {
|
||||||
map.add(new SingleTile(x,y, GamePanel.getImage("img/tiles/terrain/grassMiddleLeft.png")));
|
map.add(new SingleTile(x,y, GamePanel.getImage("img/tiles/terrain/grassMiddleLeft.png")));
|
||||||
} else if(file.charAt(i)=='s'){
|
} else if(file.charAt(i)=='s'){
|
||||||
map.add(new SingleTile(x,y, GamePanel.getImage("img/tiles/terrain/grassCenter.png")));
|
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'){
|
} else if(file.charAt(i)=='d'){
|
||||||
map.add(new SingleTile(x,y, GamePanel.getImage("img/tiles/terrain/grassMiddleRight.png")));
|
map.add(new SingleTile(x,y, GamePanel.getImage("img/tiles/terrain/grassMiddleRight.png")));
|
||||||
} else if(file.charAt(i)=='z'){
|
} else if(file.charAt(i)=='z'){
|
||||||
|
@ -66,6 +67,9 @@ public class MapReader {
|
||||||
} else if(file.charAt(i)=='!'){
|
} else if(file.charAt(i)=='!'){
|
||||||
enemy.add(new NonPlayer(x, y, GamePanel.slimeSpriteArray, 50, 28));
|
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;
|
x+=Tile.length;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,10 @@ public class Player extends GenericSprite {
|
||||||
boolean canUpdate = true;
|
boolean canUpdate = true;
|
||||||
for(int i=0; i<GamePanel.map.size(); i++) {
|
for(int i=0; i<GamePanel.map.size(); i++) {
|
||||||
if(collide(GamePanel.map.get(i),this.x+x,this.y+y)){
|
if(collide(GamePanel.map.get(i),this.x+x,this.y+y)){
|
||||||
|
if(GamePanel.map.get(i).isFinish){
|
||||||
|
LevelManager.nextLevel();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
canUpdate = false;
|
canUpdate = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,12 @@ public class Tile {
|
||||||
public int y;
|
public int y;
|
||||||
|
|
||||||
public boolean collision;
|
public boolean collision;
|
||||||
|
|
||||||
|
public boolean isFinish;
|
||||||
public int realX;
|
public int realX;
|
||||||
public static final int length = 35;
|
public static final int length = 35;
|
||||||
public Tile(int x, int y){
|
public Tile(int x, int y){
|
||||||
|
isFinish = false;
|
||||||
collision = true;
|
collision = true;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
|
Loading…
Reference in New Issue