reduced hitbox and started with objects

This commit is contained in:
2025-11-26 23:02:14 +01:00
parent 2d69c01469
commit 90dc655a6b
26 changed files with 37 additions and 4 deletions

BIN
assets/objects/axe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

BIN
assets/objects/boots.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
assets/objects/chest.png Normal file

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.3 KiB

BIN
assets/objects/door.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
assets/objects/key.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

BIN
assets/objects/lantern.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
assets/objects/pickaxe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
assets/objects/tent.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -1,6 +1,7 @@
package de.miaurizius.jgame2d.core; package de.miaurizius.jgame2d.core;
import de.miaurizius.jgame2d.entity.Player; import de.miaurizius.jgame2d.entity.Player;
import de.miaurizius.jgame2d.object.SuperObject;
import de.miaurizius.jgame2d.tile.TileManager; import de.miaurizius.jgame2d.tile.TileManager;
import javax.swing.*; import javax.swing.*;
@@ -33,6 +34,7 @@ public class GamePanel extends JPanel implements Runnable {
Thread gameThread; Thread gameThread;
public CollisionHandler collisionH = new CollisionHandler(this); public CollisionHandler collisionH = new CollisionHandler(this);
public Player player = new Player(this, keyH); public Player player = new Player(this, keyH);
public SuperObject[] obj = new SuperObject[10];
public GamePanel() { public GamePanel() {
this.setPreferredSize(new Dimension(screenWidth, screenHeight)); this.setPreferredSize(new Dimension(screenWidth, screenHeight));

View File

@@ -25,10 +25,10 @@ public class Player extends Entity {
screenY = panel.screenHeight/2 - panel.tileSize/2; screenY = panel.screenHeight/2 - panel.tileSize/2;
solidArea = new Rectangle(); solidArea = new Rectangle();
solidArea.x = 9; solidArea.x = 12;
solidArea.y = 18; solidArea.y = 20;
solidArea.width = 32; solidArea.width = 24;
solidArea.height = 32; solidArea.height = 24;
setDefaultValues(); setDefaultValues();
getPlayerImage(); getPlayerImage();

View File

@@ -0,0 +1,19 @@
package de.miaurizius.jgame2d.object;
import javax.imageio.ImageIO;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.Key;
public class KeyObj extends SuperObject {
public KeyObj() {
name = "key";
try {
image = ImageIO.read(new FileInputStream("assets/objects/key.png"));
} catch(IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,12 @@
package de.miaurizius.jgame2d.object;
import java.awt.image.BufferedImage;
public class SuperObject {
public BufferedImage image;
public String name;
public boolean collision = false;
public int worldX, worldY;
}