added a few (yet not working) objects

This commit is contained in:
2025-11-26 23:16:15 +01:00
parent 90dc655a6b
commit 09969807f3
9 changed files with 106 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ public class GamePanel extends JPanel implements Runnable {
KeyHandler keyH = new KeyHandler();
Thread gameThread;
public CollisionHandler collisionH = new CollisionHandler(this);
public AssetSetter assetSetter = new AssetSetter(this);;
public Player player = new Player(this, keyH);
public SuperObject[] obj = new SuperObject[10];
@@ -44,6 +45,10 @@ public class GamePanel extends JPanel implements Runnable {
this.setFocusable(true);
}
public void setupGame() {
assetSetter.setObject();
}
public void startGameThread() {
gameThread = new Thread(this);
gameThread.start();
@@ -71,7 +76,7 @@ public class GamePanel extends JPanel implements Runnable {
drawCount++;
}
if(timer >= 1000000000) {
//System.out.println("FPS: " + drawCount);
System.out.println("FPS: " + drawCount);
drawCount = 0;
timer = 0;
}
@@ -88,6 +93,7 @@ public class GamePanel extends JPanel implements Runnable {
//Draw all components
tileM.draw(graphics2d);
for (SuperObject superObject : obj) if (superObject != null) superObject.draw(graphics2d, this);
player.draw(graphics2d);
graphics.dispose();
}