Merge remote-tracking branch 'origin/master'

master
John 2022-06-09 14:53:33 -04:00
commit 15ceff8c92
6 changed files with 24 additions and 6 deletions

View File

@ -12,7 +12,7 @@ sssssssssssssssssd qwe q
sssssssssssssssssd asd asd zxxxxxc zxxxxxxxllllxxxxxxxxc
sssssssssssssssssd 1 zxc zxc vvvvvvvvwwwwvvvvvvvvv
sssssssssssssssssd qe vvvvvvvvvvvvvvvvvvvvv
sssssssssssssssssd ad qwwwwwwwwe vvvvvvvvvvvvvvvvvvvvv
sssssssssssssssssd ad qrsssssssstwe vvvvvvvvvvvvvvvvvvvvv
sssssssssssssssssd ad qwwrssssssssssstwe !!! qwe vvvvvvvvvvvvvvvvvvvvv +
sssssssssssssssssdlllllad qwwwwwwwwe vvvvvvvvvvvvvvvvvvvvv
sssssssssssssssssdlllllad qrsssslssstwe vvvvvvvvvvvvvvvvvvvvv
sssssssssssssssssdlllllad qwwrssssllssssstwe !!! qwe vvvvvvvvvvvvvvvvvvvvv +
ssssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrsssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrstwwwwwwwwwwwwwwwwwwwwwwwwwwwwww3

View File

@ -73,7 +73,8 @@ public class GenericSprite extends Rectangle{
}
}
private boolean collide(Tile tile, double x, double y){
public boolean collide(Tile tile, double x, double y){
if(tile==null){return false;}
if(!tile.collision){
return false;
}
@ -90,7 +91,7 @@ public class GenericSprite extends Rectangle{
int lowY = Math.max(0,(this.y/Tile.length)-6);
int highY = Math.min(lowY + 12, GamePanel.map[0].length);
for(int i=lowX; i<highX; i++) {
for (int j = 0; j < GamePanel.map[0].length; j++) {
for (int j = lowY; j < highY; j++) {
if (GamePanel.map[i][j] != null) {
if (collide(GamePanel.map[i][j], this.x + x, this.y + y)) {
if (GamePanel.map[i][j].isFinish&&isPlayer) {

View File

@ -85,11 +85,13 @@ public class MapReader {
} else if(file.charAt(i)=='+') {
newTile("img/tiles/boxes/finish.png");
GamePanel.map[x][y].isFinish = true;
GamePanel.map[x][y].nonBombCollide = 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].nonBombCollide = true;
GamePanel.map[x][y].kills = true;
if(y>0&&GamePanel.map[x][y-1]==null) {
GamePanel.particleTiles.add(GamePanel.map[x][y]);

View File

@ -75,7 +75,7 @@ public class Player extends GenericSprite {
}
}
private boolean collide(Tile tile, double x, double y){
public boolean collide(Tile tile, double x, double y){
if(tile==null){return false;}
if(!tile.collision){
return false;

View File

@ -35,6 +35,8 @@ public class StickyBomb extends GenericSprite{
erase = false;
}
public void update(){
realX = x - GamePanel.camera.x;
}
@ -69,6 +71,17 @@ public class StickyBomb extends GenericSprite{
}
}
public boolean collide(Tile tile, double x, double y){
if(!tile.collision||tile.nonBombCollide){
return false;
}
if(x+WIDTH>tile.x&&x<tile.x+Tile.length&&y-tile.y<Tile.length&&tile.y-y<HEIGHT){
return true;
}
return false;
}
public void move(){
if(yVelocity>50){yVelocity=50;}
update();

View File

@ -7,6 +7,7 @@ public class Tile {
public boolean collision;
public boolean nonBombCollide;
public boolean isFinish;
public boolean kills;
@ -18,6 +19,7 @@ public class Tile {
kills = false;
this.x = x;
this.y = y;
nonBombCollide = false;
}
public void update(){
realX = x-GamePanel.camera.x;