master
Chara1236 2022-06-19 16:20:31 -04:00
parent 7ee87d65eb
commit d071e51c5b
4 changed files with 19 additions and 10 deletions

View File

@ -12,7 +12,7 @@ sssssssssssssssssd
sssssssssssssssssd zxc asd asd zxxxxxc zxxxxxxxllllxxxxxxxxc ad
sssssssssssssssssd 1 zxc zxc vvvvvvvvwwwwvvvvvvvvv ad
sssssssssssssssssd qe vvvvvvvvvvvvvvvvvvvvv ad
sssssssssssssssssdlllllad 2 hqwwwwwwwwe vvvvvvvvvvvvvvvvvvvvv ad
sssssssssssssssssdlllllad 2 qwwwwwwwwe vvvvvvvvvvvvvvvvvvvvv ad
sssssssssssssssssdlllllad bbb s qrsssslssstwe vvvvvvvvvvvvvvvvvvvvv ad
sssssssssssssssssdllllladbb s ooqwwrssssllssssstwe !!! qwe vvvvvvvvvvvvvvvvvvvvv + ad
sssssssssssssssssdllllladbb s ooqwwrssssllssssstwe ! b h !!! qwe vvvvvvvvvvvvvvvvvvvvv + ad
ssssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrsssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww3

View File

@ -6,7 +6,10 @@ public class FireBall extends GenericSprite{
private int realX;
public boolean dead;
public FireBall(int x, int y, int height, int width, int xv, int yv, String dir) {
public static final int height = 8;
public static final int width = 16;
public FireBall(int x, int y, int xv, int yv, String dir) {
super(x, y, height, width);
xVelocity = xv;
yVelocity = yv;
@ -20,6 +23,13 @@ public class FireBall extends GenericSprite{
public void update(){
realX = x-GameFrame.game.camera.x;
}
public boolean collidePlayer(Player p){
if(realX+width>p.x&&realX<p.x+Player.PLAYER_WIDTH&&y-p.y<Player.PLAYER_HEIGHT&&p.y-y<height){
return true;
}
return false;
}
public void move(){
update();
if(canUpdate(xVelocity,yVelocity)) {
@ -28,6 +38,10 @@ public class FireBall extends GenericSprite{
} else {
dead = true;
}
if(collidePlayer(GameFrame.game.player)){
dead = true;
GameFrame.game.player.reset();
}
}
public void draw(Graphics g) throws IOException {
g.drawImage(GamePanel.getImage(spritePath),x-GameFrame.game.camera.x,y,null);

View File

@ -467,7 +467,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
public void updateShootingBlock(){
for(Tile i: shootingTiles){
if(i.shootingDir.equals("left")){
fireballs.add(new FireBall(i.x-20,i.y+Tile.length/2,8,16,-fireballSpeed,0,"left"));
fireballs.add(new FireBall(i.x-20,i.y+Tile.length/2-FireBall.height/2,-fireballSpeed,0,"left"));
}
}
}

View File

@ -130,12 +130,7 @@ public class Player extends GenericSprite {
return canUpdate;
}
// public boolean SteelCollide(GenericSprite g, int x, int y){
// if(x+WIDTH>tile.realX&&x<tile.realX+Tile.length&&y-tile.y<Tile.length&&tile.y-y<HEIGHT){
// return true;
// }
// return false;
// }
public void updatePlaceSteel(int x, int y){
if(this.y<0){
canPlaceSteel = false;