added map tiles
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package de.miaurizius.jgame2d.core;
|
||||
|
||||
import de.miaurizius.jgame2d.entity.Player;
|
||||
import de.miaurizius.jgame2d.tile.TileManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -21,15 +22,11 @@ public class GamePanel extends JPanel implements Runnable {
|
||||
//FPS
|
||||
int FPS = 60;
|
||||
|
||||
TileManager tileM = new TileManager(this);
|
||||
KeyHandler keyH = new KeyHandler();
|
||||
Thread gameThread;
|
||||
Player player = new Player(this, keyH);
|
||||
|
||||
//Default position
|
||||
int playerX = 100;
|
||||
int playerY = 100;
|
||||
int playerSpeed = 4;
|
||||
|
||||
public GamePanel() {
|
||||
this.setPreferredSize(new Dimension(screenWidth, screenHeight));
|
||||
this.setBackground(Color.black);
|
||||
@@ -79,6 +76,9 @@ public class GamePanel extends JPanel implements Runnable {
|
||||
public void paintComponent(Graphics graphics) {
|
||||
super.paintComponent(graphics);
|
||||
Graphics2D graphics2d = (Graphics2D) graphics;
|
||||
|
||||
//Draw all components
|
||||
tileM.draw(graphics2d);
|
||||
player.draw(graphics2d);
|
||||
graphics.dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user