Added Lava

master
Chara1236 2022-06-07 23:59:19 -04:00
parent 8f3f35a4af
commit d5bf288c26
7 changed files with 30 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

BIN
img/tiles/terrain/lava.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -4,15 +4,15 @@ sssssssssssssssssd 1
sssssssssssssssssd sssssssssssssssssd
sssssssssssssssssd sssssssssssssssssd
sssssssssssssssssd 1 1 1 1 1 sssssssssssssssssd 1 1 1 1 1
sssssssssssssssssd w 1 sssssssssssssssssd 1
sssssssssssssssssd w sssssssssssssssssd
sssssssssssssssssd w qe qe sssssssssssssssssd qe qe
sssssssssssssssssd w ad ! ad sssssssssssssssssd ad ! ad
sssssssssssssssssd w qwe qwe atwwwrd sssssssssssssssssd qwe qwe atwwwrd qwwwwwwellllqwwwwwwwe
sssssssssssssssssd w asd asd zxxxxxc sssssssssssssssssd asd asd zxxxxxc zxxxxxxxwwwwxxxxxxxxc
sssssssssssssssssd w 1 zxc zxc sssssssssssssssssd 1 zxc zxc vvvvvvvvvvvvvvvvvvvvv
sssssssssssssssssd qe sssssssssssssssssd qe vvvvvvvvvvvvvvvvvvvvv
sssssssssssssssssd ad qwwwwwwwwe sssssssssssssssssd ad qwwwwwwwwe vvvvvvvvvvvvvvvvvvvvv
sssssssssssssssssd ad qrsssssssstwe sssssssssssssssssd ad qrsssssssstwe vvvvvvvvvvvvvvvvvvvvv
sssssssssssssssssd ad qwwrssssssssssstwe !!! qwe + sssssssssssssssssd ad qwwrssssssssssstwe !!! qwe vvvvvvvvvvvvvvvvvvvvv +
ssssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrsssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrstwwwwww3 ssssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrsssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrstwwwwwwwwwwwwwwwwwwwwwwwwwwwwww3

View File

@ -20,6 +20,7 @@ public class MapReader {
asd asd
zxc zxc
!: Slime !: Slime
v= background
Grass: Grass:
*/ */
@ -83,6 +84,12 @@ public class MapReader {
} else if(file.charAt(i)=='+') { } else if(file.charAt(i)=='+') {
newTile("img/tiles/boxes/finish.png"); newTile("img/tiles/boxes/finish.png");
GamePanel.map[x][y].isFinish = true; GamePanel.map[x][y].isFinish = true;
} else if(file.charAt(i)=='v'){
newTile("img/tiles/background/wall.png");
GamePanel.map[x][y].collision = false;
} else if(file.charAt(i)=='l'){
newTile("img/tiles/terrain/lava.png");
GamePanel.map[x][y].kills = true;
} }
x+=1; x+=1;
} }

View File

@ -101,6 +101,10 @@ public class Player extends GenericSprite {
LevelManager.nextLevel(); LevelManager.nextLevel();
return true; return true;
} }
if (GamePanel.map[i][j].kills) {
GamePanel.player.reset();
return true;
}
canUpdate = false; canUpdate = false;
break; break;
} }

View File

@ -31,14 +31,14 @@ public class StickyBomb extends GenericSprite{
} }
public void explode(){ public void explode(){
double yDis = GamePanel.player.y+Player.PLAYER_HEIGHT/2-(y+length/2); double yDis = GamePanel.player.y+Player.PLAYER_HEIGHT/2-(y+(double)length/2);
double xDis = GamePanel.player.x+Player.PLAYER_HEIGHT/2-(realX+length/2); double xDis = GamePanel.player.x+Player.PLAYER_HEIGHT/2-(realX+(double)length/2);
double hypo = Math.sqrt(yDis*yDis+xDis+xDis); double hypo = Math.sqrt(yDis*yDis+xDis+xDis);
if(yDis!=0){ if(yDis!=0){
GamePanel.player.yVelocity = 10000/(yDis*hypo); GamePanel.player.yVelocity += 10000/(yDis*hypo);
} }
if(xDis!=0) { if(xDis!=0) {
GamePanel.player.xVelocity = 100000/(xDis*hypo); GamePanel.player.xVelocity += 100000/(xDis*hypo);
} }
GamePanel.player.capSpeed(); GamePanel.player.capSpeed();
alive = false; alive = false;

View File

@ -8,11 +8,14 @@ public class Tile {
public boolean collision; public boolean collision;
public boolean isFinish; public boolean isFinish;
public boolean kills;
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; isFinish = false;
collision = true; collision = true;
kills = false;
this.x = x; this.x = x;
this.y = y; this.y = y;
} }