start of attacking

This commit is contained in:
2025-11-29 01:23:28 +01:00
parent ead9abbe74
commit 65061d721d
26 changed files with 33 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

View File

@@ -31,6 +31,7 @@ public class Entity {
int dialogueIndex = 0;
public boolean collisionOn = false;
public boolean invincible = false;
boolean attacking = false; //TODO: https://youtu.be/HL39xRzPpm4?t=551
// COUNTER
public int spriteCounter = 0;
@@ -127,4 +128,13 @@ public class Entity {
return null;
}
public BufferedImage initEntitySprites(String name, int width, int height) {
try {
return Utility.scaleImage(ImageIO.read(new FileInputStream("assets/" + name + ".png")), width, height);
} catch (IOException e) {
Boot.logger.log(Level.SEVERE, "Could not load entity-image", e);
}
return null;
}
}

View File

@@ -31,13 +31,12 @@ public class Player extends Entity {
setDefaultValues();
getPlayerImage();
getPlayerAttackImage();
}
public void setDefaultValues() {
worldX = panel.tileSize * 23;
worldY = panel.tileSize * 21;
// worldX = panel.tileSize * 10;
// worldY = panel.tileSize * 13;
speed = 4;
direction = Direction.DOWN;
@@ -46,17 +45,6 @@ public class Player extends Entity {
life = maxLife;
}
public void getPlayerImage() {
up1 = initEntitySprites("player/boy_up_1");
up2 = initEntitySprites("player/boy_up_2");
down1 = initEntitySprites("player/boy_down_1");
down2 = initEntitySprites("player/boy_down_2");
left1 = initEntitySprites("player/boy_left_1");
left2 = initEntitySprites("player/boy_left_2");
right1 = initEntitySprites("player/boy_right_1");
right2 = initEntitySprites("player/boy_right_2");
}
public void update() {
// MOVEMENT
if(keyH.upPressed || keyH.downPressed || keyH.leftPressed || keyH.rightPressed || keyH.spacePressed) {
@@ -147,4 +135,26 @@ public class Player extends Entity {
super.speak();
}
public void getPlayerImage() {
up1 = initEntitySprites("player/boy_up_1");
up2 = initEntitySprites("player/boy_up_2");
down1 = initEntitySprites("player/boy_down_1");
down2 = initEntitySprites("player/boy_down_2");
left1 = initEntitySprites("player/boy_left_1");
left2 = initEntitySprites("player/boy_left_2");
right1 = initEntitySprites("player/boy_right_1");
right2 = initEntitySprites("player/boy_right_2");
}
public void getPlayerAttackImage() {
attackUp1 = initEntitySprites("player/attack/boy_attack_up_1", panel.tileSize, panel.tileSize*2);
attackUp2 = initEntitySprites("player/attack/boy_attack_up_2", panel.tileSize, panel.tileSize*2);
attackDown1 = initEntitySprites("player/attack/boy_attack_down_1", panel.tileSize, panel.tileSize*2);
attackDown2 = initEntitySprites("player/attack/boy_attack_down_2", panel.tileSize, panel.tileSize*2);
attackLeft1 = initEntitySprites("player/attack/boy_attack_left_1", panel.tileSize*2, panel.tileSize);
attackLeft2 = initEntitySprites("player/attack/boy_attack_left_2", panel.tileSize*2, panel.tileSize);
attackRight1 = initEntitySprites("player/attack/boy_attack_right_1", panel.tileSize*2, panel.tileSize);
attackRight2 = initEntitySprites("player/attack/boy_attack_right_2", panel.tileSize*2, panel.tileSize);
}
}