Compare commits
4 Commits
2490b976ad
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| f317d28c9c | |||
| aa21a21fcc | |||
| 30ab25f5cb | |||
| b3750271c0 |
39
.gitignore
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
/.idea/
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
17
pom.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>My2DGameAlt</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
9
src/main/java/se/urmo/my2dgame/Main.java
Normal file
@ -0,0 +1,9 @@
|
||||
package se.urmo.my2dgame;
|
||||
|
||||
import se.urmo.my2dgame.main.Game;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
new Game().start();
|
||||
}
|
||||
}
|
||||
45
src/main/java/se/urmo/my2dgame/entity/Entity.java
Normal file
@ -0,0 +1,45 @@
|
||||
package se.urmo.my2dgame.entity;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public abstract class Entity {
|
||||
public int worldX;
|
||||
public int worldY;
|
||||
public int speed;
|
||||
|
||||
public static BufferedImage[] entityImages;
|
||||
public Direction direction;
|
||||
|
||||
public int spriteCount = 0;
|
||||
public int spriteNum = 1;
|
||||
|
||||
public Rectangle solidArea;
|
||||
|
||||
public abstract int boxLeft();
|
||||
public abstract int boxRight();
|
||||
public abstract int boxTop();
|
||||
public abstract int boxBottom();
|
||||
|
||||
public enum Direction {
|
||||
N, NE, E, SE, S, SW, W, NW;
|
||||
}
|
||||
protected final EnumSet<Direction> norths = EnumSet.of(Direction.N, Direction.NE, Direction.NW);
|
||||
protected final EnumSet<Direction> souths = EnumSet.of(Direction.S, Direction.SE, Direction.SW);
|
||||
protected final EnumSet<Direction> easts = EnumSet.of(Direction.E, Direction.NE, Direction.SE);
|
||||
protected final EnumSet<Direction> wests = EnumSet.of(Direction.W, Direction.NW, Direction.SW);
|
||||
|
||||
protected static final Map<Point, Direction> DIRECTION_MAP = Map.ofEntries(
|
||||
Map.entry(new Point(0, -1), Direction.N),
|
||||
Map.entry(new Point(1, -1), Direction.NE),
|
||||
Map.entry(new Point(1, 0), Direction.E),
|
||||
Map.entry(new Point(1, 1), Direction.SE),
|
||||
Map.entry(new Point(0, 1), Direction.S),
|
||||
Map.entry(new Point(-1, 1), Direction.SW),
|
||||
Map.entry(new Point(-1, 0), Direction.W),
|
||||
Map.entry(new Point(-1, -1), Direction.NW)
|
||||
);
|
||||
}
|
||||
147
src/main/java/se/urmo/my2dgame/entity/Player.java
Normal file
@ -0,0 +1,147 @@
|
||||
package se.urmo.my2dgame.entity;
|
||||
|
||||
import se.urmo.my2dgame.util.ImageUtil;
|
||||
import se.urmo.my2dgame.util.CollisionChecker;
|
||||
import se.urmo.my2dgame.main.KeyHandler;
|
||||
import se.urmo.my2dgame.main.Screen;
|
||||
import se.urmo.my2dgame.main.UpdateListener;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public class Player extends Entity implements UpdateListener {
|
||||
private static final int up1 = 0, up2 = 1, down1 = 2, down2 = 3, left1 = 4, left2 = 5, right1 = 6, right2 = 7;
|
||||
private final CollisionChecker collisionChecker;
|
||||
private final KeyHandler keyHandler;
|
||||
public static final int SCREEN_X = Screen.SCREEN_WIDTH / 2 - (Screen.TILE_SIZE / 2);
|
||||
public static final int SCREEN_Y = Screen.SCREEN_HEIGHT / 2 - (Screen.TILE_SIZE / 2);
|
||||
|
||||
static {
|
||||
entityImages = new BufferedImage[8];
|
||||
entityImages[up1] = ImageUtil.loadImage("/player/boy_up_1.png");
|
||||
entityImages[up2] = ImageUtil.loadImage("/player/boy_up_2.png");
|
||||
entityImages[down1] = ImageUtil.loadImage("/player/boy_down_1.png");
|
||||
entityImages[down2] = ImageUtil.loadImage("/player/boy_down_2.png");
|
||||
entityImages[left1] = ImageUtil.loadImage("/player/boy_left_1.png");
|
||||
entityImages[left2] = ImageUtil.loadImage("/player/boy_left_2.png");
|
||||
entityImages[right1] = ImageUtil.loadImage("/player/boy_right_1.png");
|
||||
entityImages[right2] = ImageUtil.loadImage("/player/boy_right_2.png");
|
||||
}
|
||||
|
||||
public Player(CollisionChecker collisionChecker, KeyHandler keyHandler) {
|
||||
this.collisionChecker = collisionChecker;
|
||||
this.keyHandler = keyHandler;
|
||||
|
||||
solidArea = new Rectangle(8, 16, 32, 32);
|
||||
|
||||
worldX = Screen.TILE_SIZE * 22;
|
||||
worldY = Screen.TILE_SIZE * 22;
|
||||
speed = 1;
|
||||
direction = Direction.S;
|
||||
}
|
||||
|
||||
|
||||
public void update() {
|
||||
if (keyHandler.upPressed || keyHandler.downPressed
|
||||
|| keyHandler.leftPressed || keyHandler.rightPressed) {
|
||||
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
|
||||
// Vertical movement
|
||||
if (keyHandler.upPressed && !keyHandler.downPressed) {
|
||||
dy = -1;
|
||||
} else if (keyHandler.downPressed && !keyHandler.upPressed) {
|
||||
dy = 1;
|
||||
}
|
||||
|
||||
// Horizontal movement
|
||||
if (keyHandler.rightPressed && !keyHandler.leftPressed) {
|
||||
dx = 1;
|
||||
} else if (keyHandler.leftPressed && !keyHandler.rightPressed) {
|
||||
dx = -1;
|
||||
}
|
||||
|
||||
// Apply movement
|
||||
worldX += dx * speed;
|
||||
worldY += dy * speed;
|
||||
|
||||
// Lookup direction
|
||||
Point movement = new Point(dx, dy);
|
||||
direction = DIRECTION_MAP.getOrDefault(movement, direction);
|
||||
|
||||
if (direction != null && collisionChecker.checkTile(this)) {
|
||||
if (norths.contains(direction)) {
|
||||
worldY += speed; // negate
|
||||
}
|
||||
if (souths.contains(direction)) {
|
||||
worldY -= speed; // negate
|
||||
}
|
||||
if (easts.contains(direction)) {
|
||||
worldX -= speed; // negate
|
||||
}
|
||||
if (wests.contains(direction)) {
|
||||
worldX += speed; // negate
|
||||
}
|
||||
}
|
||||
|
||||
spriteCount++;
|
||||
if (spriteCount == 30) { // sprite animation update speed - only uodate animation every 30
|
||||
if (spriteNum == 1) {
|
||||
spriteNum = 2;
|
||||
} else if (spriteNum == 2) {
|
||||
spriteNum = 1;
|
||||
}
|
||||
spriteCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(Graphics2D g2d) {
|
||||
BufferedImage image = null;
|
||||
switch (direction) {
|
||||
case N -> image = spriteNum == 1 ? entityImages[up1] : entityImages[up2];
|
||||
case S -> image = spriteNum == 1 ? entityImages[down1] : entityImages[down2];
|
||||
case W, NW, SW -> image = spriteNum == 1 ? entityImages[left1] : entityImages[left2];
|
||||
case E, NE, SE -> image = spriteNum == 1 ? entityImages[right1] : entityImages[right2];
|
||||
}
|
||||
|
||||
g2d.drawImage(image, SCREEN_X, SCREEN_Y, Screen.TILE_SIZE, Screen.TILE_SIZE, null);
|
||||
}
|
||||
|
||||
private void drawRectangel(Graphics2D g2d) {
|
||||
int num = (worldX - 24) / Screen.TILE_SIZE;
|
||||
int num2 = (worldY - 24) / Screen.TILE_SIZE;
|
||||
g2d.drawRect(SCREEN_X - Screen.TILE_SIZE, SCREEN_Y - Screen.TILE_SIZE, 48, 48);
|
||||
g2d.drawString(num + "," + num2, SCREEN_X - Screen.TILE_SIZE + 10, SCREEN_Y - Screen.TILE_SIZE + 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int boxLeft() {
|
||||
// solidare left side
|
||||
return this.worldX + this.solidArea.x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int boxRight() {
|
||||
// solidare right side
|
||||
return this.worldX + this.solidArea.x + this.solidArea.width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int boxTop() {
|
||||
// solidarea top
|
||||
return this.worldY + this.solidArea.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int boxBottom() {
|
||||
// solidarea bottom
|
||||
return this.worldY + this.solidArea.y + this.solidArea.height;
|
||||
}
|
||||
}
|
||||
89
src/main/java/se/urmo/my2dgame/main/Game.java
Normal file
@ -0,0 +1,89 @@
|
||||
package se.urmo.my2dgame.main;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Game implements Runnable {
|
||||
private final static int FPS_SET = 120;
|
||||
private final static int UPS_SET = 200;
|
||||
private final static double timePerFrame = 1000000000.0 / FPS_SET;
|
||||
private final static double timePerUpdate = 1000000000.0 / UPS_SET;
|
||||
|
||||
private final List<UpdateListener> updateListeners = new ArrayList<>();
|
||||
|
||||
private Thread gameThread;
|
||||
private final JFrame window = new JFrame();
|
||||
private final Screen screen = new Screen(this);
|
||||
|
||||
public void start() {
|
||||
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
window.setResizable(false);
|
||||
window.setTitle("2d");
|
||||
|
||||
|
||||
window.add(screen);
|
||||
|
||||
window.pack();
|
||||
|
||||
window.setLocationRelativeTo(null);
|
||||
window.setVisible(true);
|
||||
|
||||
screen.setupGame();
|
||||
startGameThread();
|
||||
}
|
||||
|
||||
public void addUpdateListener(UpdateListener listener) {
|
||||
updateListeners.add(listener);
|
||||
}
|
||||
|
||||
private void notifyUpdate() {
|
||||
for (UpdateListener listener : updateListeners) {
|
||||
listener.onUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public void startGameThread() {
|
||||
this.gameThread = new Thread(this);
|
||||
gameThread.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
long previousTime = System.nanoTime();
|
||||
|
||||
int frames = 0;
|
||||
int updates = 0;
|
||||
long lastCheck = System.currentTimeMillis();
|
||||
|
||||
double deltaU = 0;
|
||||
double deltaF = 0;
|
||||
|
||||
while (gameThread !=null && gameThread.isAlive()) {
|
||||
long currentTime = System.nanoTime();
|
||||
deltaU += (currentTime - previousTime) / timePerUpdate;
|
||||
deltaF += (currentTime - previousTime) / timePerFrame;
|
||||
|
||||
previousTime = currentTime;
|
||||
|
||||
if (deltaU >= 1) {
|
||||
notifyUpdate();
|
||||
updates++;
|
||||
deltaU--;
|
||||
}
|
||||
|
||||
if (deltaF >= 1) {
|
||||
screen.repaint(); // triggers JPanel paintComponent
|
||||
frames++;
|
||||
deltaF--;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - lastCheck >= 1000) {
|
||||
lastCheck = System.currentTimeMillis();
|
||||
System.out.println("FPS: " + frames + " | UPS: " + updates);
|
||||
frames = 0;
|
||||
updates = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
48
src/main/java/se/urmo/my2dgame/main/KeyHandler.java
Normal file
@ -0,0 +1,48 @@
|
||||
package se.urmo.my2dgame.main;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
|
||||
public class KeyHandler implements KeyListener {
|
||||
public boolean upPressed;
|
||||
public boolean leftPressed;
|
||||
public boolean downPressed;
|
||||
public boolean rightPressed;
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
int keyCode = e.getKeyCode();
|
||||
if (keyCode == KeyEvent.VK_W) {
|
||||
upPressed = true;
|
||||
}
|
||||
if (keyCode == KeyEvent.VK_S) {
|
||||
downPressed = true;
|
||||
}
|
||||
if (keyCode == KeyEvent.VK_A) {
|
||||
leftPressed = true;
|
||||
}
|
||||
if (keyCode == KeyEvent.VK_D) {
|
||||
rightPressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
int keyCode = e.getKeyCode();
|
||||
if (keyCode == KeyEvent.VK_W) {
|
||||
upPressed = false;
|
||||
}
|
||||
if (keyCode == KeyEvent.VK_S) {
|
||||
downPressed = false;
|
||||
}
|
||||
if (keyCode == KeyEvent.VK_A) {
|
||||
leftPressed = false;
|
||||
}
|
||||
if (keyCode == KeyEvent.VK_D) {
|
||||
rightPressed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
src/main/java/se/urmo/my2dgame/main/Screen.java
Normal file
@ -0,0 +1,64 @@
|
||||
package se.urmo.my2dgame.main;
|
||||
|
||||
import se.urmo.my2dgame.entity.Player;
|
||||
import se.urmo.my2dgame.object.AssetSetter;
|
||||
import se.urmo.my2dgame.object.SuperObject;
|
||||
import se.urmo.my2dgame.tile.World;
|
||||
import se.urmo.my2dgame.util.CollisionChecker;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Screen extends JPanel {
|
||||
//SCREEN SETTINGS
|
||||
public static final int ORIGINAL_TILE_SIZE = 16;
|
||||
public static final int SCALE = 3;
|
||||
public static final int TILE_SIZE = ORIGINAL_TILE_SIZE * SCALE;
|
||||
public static final int MAX_SCREEN_COL = 16;
|
||||
public static final int MAX_SCREEN_ROW = 12;
|
||||
public static final int SCREEN_WIDTH = MAX_SCREEN_COL * TILE_SIZE;
|
||||
public static final int SCREEN_HEIGHT = MAX_SCREEN_ROW * TILE_SIZE;
|
||||
|
||||
|
||||
World world = new World(this);
|
||||
KeyHandler keyHandler = new KeyHandler();
|
||||
|
||||
public CollisionChecker collisionChecker = new CollisionChecker(world);
|
||||
public AssetSetter assetSetter = new AssetSetter(this);
|
||||
public Player player = new Player(collisionChecker, keyHandler);
|
||||
public SuperObject[] obj = new SuperObject[10];
|
||||
|
||||
public Screen(Game game) {
|
||||
game.addUpdateListener(player);
|
||||
this.setPreferredSize(new Dimension(SCREEN_WIDTH, SCREEN_HEIGHT));
|
||||
this.setBackground(Color.BLACK);
|
||||
this.setDoubleBuffered(true);
|
||||
this.addKeyListener(keyHandler);
|
||||
this.setFocusable(true);
|
||||
}
|
||||
|
||||
public void setupGame(){
|
||||
assetSetter.setObject();
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
|
||||
world.draw(g2d);
|
||||
Arrays.stream(obj)
|
||||
.filter(Objects::nonNull)
|
||||
.forEach(o -> o.draw(g2d, this));
|
||||
player.draw(g2d);
|
||||
g2d.dispose();
|
||||
}
|
||||
|
||||
public boolean isWithinScreen(int worldX, int worldY) {
|
||||
return worldX + TILE_SIZE > player.worldX - player.SCREEN_X &&
|
||||
worldX - TILE_SIZE < player.worldX + player.SCREEN_X &&
|
||||
worldY + TILE_SIZE > player.worldY - player.SCREEN_Y &&
|
||||
worldY - TILE_SIZE < player.worldY + player.SCREEN_Y;
|
||||
}
|
||||
}
|
||||
5
src/main/java/se/urmo/my2dgame/main/UpdateListener.java
Normal file
@ -0,0 +1,5 @@
|
||||
package se.urmo.my2dgame.main;
|
||||
|
||||
public interface UpdateListener {
|
||||
void onUpdate();
|
||||
}
|
||||
15
src/main/java/se/urmo/my2dgame/object/AssetSetter.java
Normal file
@ -0,0 +1,15 @@
|
||||
package se.urmo.my2dgame.object;
|
||||
|
||||
import se.urmo.my2dgame.main.Screen;
|
||||
|
||||
public class AssetSetter {
|
||||
Screen screen;
|
||||
public AssetSetter(Screen screen) {
|
||||
this.screen = screen;
|
||||
}
|
||||
|
||||
public void setObject() {
|
||||
screen.obj[0] = new Key(23 * Screen.TILE_SIZE, 7 * Screen.TILE_SIZE);
|
||||
screen.obj[1] = new Key(23 * Screen.TILE_SIZE, 40 * Screen.TILE_SIZE);
|
||||
}
|
||||
}
|
||||
18
src/main/java/se/urmo/my2dgame/object/Key.java
Normal file
@ -0,0 +1,18 @@
|
||||
package se.urmo.my2dgame.object;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Key extends SuperObject{
|
||||
public Key(int x, int y) {
|
||||
name = "Key";
|
||||
worldX = x;
|
||||
worldY = y;
|
||||
|
||||
try{
|
||||
image = ImageIO.read(getClass().getResourceAsStream("/objects/key.png"));
|
||||
}catch(IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/main/java/se/urmo/my2dgame/object/SuperObject.java
Normal file
@ -0,0 +1,23 @@
|
||||
package se.urmo.my2dgame.object;
|
||||
|
||||
import se.urmo.my2dgame.entity.Player;
|
||||
import se.urmo.my2dgame.main.Screen;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public class SuperObject {
|
||||
public String name;
|
||||
public BufferedImage image;
|
||||
public int worldX;
|
||||
public int worldY;
|
||||
|
||||
public void draw(Graphics2D g2d, Screen screen) {
|
||||
// Only drawImage for tiles within camera
|
||||
if(screen.isWithinScreen(worldX, worldY)) {
|
||||
int screenX = worldX - screen.player.worldX + Player.SCREEN_X;
|
||||
int screenY = worldY - screen.player.worldY + Player.SCREEN_Y;
|
||||
g2d.drawImage(image, screenX, screenY, Screen.TILE_SIZE, Screen.TILE_SIZE, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/main/java/se/urmo/my2dgame/tile/Tile.java
Normal file
@ -0,0 +1,23 @@
|
||||
package se.urmo.my2dgame.tile;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public class Tile {
|
||||
private BufferedImage image;
|
||||
private boolean collission = false;
|
||||
|
||||
public Tile(BufferedImage image) {
|
||||
this(image, false);
|
||||
}
|
||||
public Tile(BufferedImage image, boolean collission) {
|
||||
this.image = image;
|
||||
this.collission = collission;
|
||||
}
|
||||
|
||||
public boolean isCollision() {
|
||||
return collission;
|
||||
}
|
||||
public BufferedImage getImage(){
|
||||
return image;
|
||||
}
|
||||
}
|
||||
21
src/main/java/se/urmo/my2dgame/tile/TileManager.java
Normal file
@ -0,0 +1,21 @@
|
||||
package se.urmo.my2dgame.tile;
|
||||
|
||||
import se.urmo.my2dgame.util.ImageUtil;
|
||||
|
||||
public class TileManager {
|
||||
|
||||
private static final Tile[] tiles = new Tile[10];
|
||||
|
||||
static {
|
||||
tiles[0] = new Tile(ImageUtil.loadImage("/tiles/grass.png"));
|
||||
tiles[1] = new Tile(ImageUtil.loadImage("/tiles/wall.png"), true);
|
||||
tiles[2] = new Tile(ImageUtil.loadImage("/tiles/water.png"), true);
|
||||
tiles[3] = new Tile(ImageUtil.loadImage("/tiles/earth.png"), true);
|
||||
tiles[4] = new Tile(ImageUtil.loadImage("/tiles/tree.png"), true);
|
||||
tiles[5] = new Tile(ImageUtil.loadImage("/tiles/sand.png"));
|
||||
}
|
||||
|
||||
public static Tile[] getTiles() {
|
||||
return tiles;
|
||||
}
|
||||
}
|
||||
72
src/main/java/se/urmo/my2dgame/tile/World.java
Normal file
@ -0,0 +1,72 @@
|
||||
package se.urmo.my2dgame.tile;
|
||||
|
||||
import se.urmo.my2dgame.entity.Player;
|
||||
import se.urmo.my2dgame.main.Screen;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class World {
|
||||
public static final int WORLD_MAX_COL = 50;
|
||||
public static final int WORLD_MAX_ROW = 50;
|
||||
Screen screen;
|
||||
public static Tile[] tiles = TileManager.getTiles();
|
||||
public int[][] mapTileNum;
|
||||
|
||||
|
||||
public World(Screen screen) {
|
||||
this.screen = screen;
|
||||
this.mapTileNum = loadMap("/maps/world01.txt");
|
||||
}
|
||||
|
||||
private int[][] loadMap(String path) {
|
||||
int[][] map = new int[WORLD_MAX_ROW][WORLD_MAX_COL];
|
||||
try {
|
||||
InputStream stream = Screen.class.getResourceAsStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
|
||||
int row = 0;
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null && row < WORLD_MAX_ROW) {
|
||||
map[row++] = Arrays.stream(line.split(" "))
|
||||
.mapToInt(Integer::parseInt)
|
||||
.toArray();
|
||||
}
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public void draw(Graphics2D g2d) {
|
||||
int worldCol = 0;
|
||||
int worldRow = 0;
|
||||
|
||||
while (worldCol < WORLD_MAX_COL && worldRow < WORLD_MAX_ROW) {
|
||||
int tileNum = mapTileNum[worldRow][worldCol];
|
||||
|
||||
int worldX = worldCol * Screen.TILE_SIZE;
|
||||
int worldY = worldRow * Screen.TILE_SIZE;
|
||||
|
||||
// Only drawImage for tiles within camera
|
||||
if (screen.isWithinScreen(worldX, worldY)) {
|
||||
int screenX = worldX - screen.player.worldX + Player.SCREEN_X;
|
||||
int screenY = worldY - screen.player.worldY + Player.SCREEN_Y;
|
||||
g2d.drawImage(tiles[tileNum].getImage(), screenX, screenY, Screen.TILE_SIZE, Screen.TILE_SIZE, null);
|
||||
}
|
||||
|
||||
worldCol++;
|
||||
|
||||
if (worldCol == WORLD_MAX_COL) {
|
||||
worldCol = 0;
|
||||
worldRow++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
76
src/main/java/se/urmo/my2dgame/util/CollisionChecker.java
Normal file
@ -0,0 +1,76 @@
|
||||
package se.urmo.my2dgame.util;
|
||||
|
||||
import se.urmo.my2dgame.entity.Entity;
|
||||
import se.urmo.my2dgame.main.Screen;
|
||||
import se.urmo.my2dgame.tile.World;
|
||||
|
||||
public class CollisionChecker {
|
||||
|
||||
private final World world;
|
||||
|
||||
public CollisionChecker(World world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public boolean checkTile(Entity entity) {
|
||||
int entityLeftCol = entity.boxLeft() / Screen.TILE_SIZE;
|
||||
int entityRightCol = entity.boxRight() / Screen.TILE_SIZE;
|
||||
int entityTopRow = entity.boxTop() / Screen.TILE_SIZE;
|
||||
int entityBottomRow = entity.boxBottom() / Screen.TILE_SIZE;
|
||||
|
||||
switch (entity.direction){
|
||||
case N -> {
|
||||
entityTopRow = (entity.boxTop() - entity.speed)/ Screen.TILE_SIZE;
|
||||
return isNonePassable(entityTopRow, entityLeftCol, entityTopRow, entityRightCol);
|
||||
}
|
||||
case S -> {
|
||||
entityBottomRow = (entity.boxBottom() + entity.speed)/ Screen.TILE_SIZE;
|
||||
return isNonePassable(entityBottomRow,entityLeftCol,entityBottomRow,entityRightCol);
|
||||
}
|
||||
case W -> {
|
||||
entityLeftCol = (entity.boxLeft() - entity.speed)/ Screen.TILE_SIZE;
|
||||
return isNonePassable(entityTopRow, entityLeftCol, entityBottomRow, entityLeftCol);
|
||||
}
|
||||
case E -> {
|
||||
entityRightCol = (entity.boxRight() + entity.speed)/ Screen.TILE_SIZE;
|
||||
return isNonePassable(entityTopRow, entityRightCol, entityBottomRow, entityRightCol);
|
||||
}
|
||||
case NE -> {
|
||||
entityTopRow = (entity.boxTop() - entity.speed)/ Screen.TILE_SIZE;
|
||||
entityRightCol = (entity.boxRight() + entity.speed)/ Screen.TILE_SIZE;
|
||||
entityLeftCol = (entity.boxLeft() + entity.speed)/ Screen.TILE_SIZE;
|
||||
entityBottomRow = (entity.boxBottom() - entity.speed)/ Screen.TILE_SIZE;
|
||||
return isNonePassable(entityTopRow, entityLeftCol, entityBottomRow, entityRightCol);
|
||||
}
|
||||
case NW -> {
|
||||
entityTopRow = (entity.boxTop() - entity.speed)/ Screen.TILE_SIZE;
|
||||
entityRightCol = (entity.boxRight() - entity.speed)/ Screen.TILE_SIZE;
|
||||
entityLeftCol = (entity.boxLeft() - entity.speed)/ Screen.TILE_SIZE;
|
||||
entityBottomRow = (entity.boxBottom() - entity.speed)/ Screen.TILE_SIZE;
|
||||
return isNonePassable(entityBottomRow, entityLeftCol, entityTopRow, entityRightCol);
|
||||
}
|
||||
case SW -> {
|
||||
entityTopRow = (entity.boxTop() + entity.speed)/ Screen.TILE_SIZE;
|
||||
entityRightCol = (entity.boxRight() - entity.speed)/ Screen.TILE_SIZE;
|
||||
entityLeftCol = (entity.boxLeft() - entity.speed)/ Screen.TILE_SIZE;
|
||||
entityBottomRow = (entity.boxBottom() + entity.speed)/ Screen.TILE_SIZE;
|
||||
return isNonePassable(entityTopRow, entityLeftCol, entityBottomRow, entityRightCol);
|
||||
}
|
||||
case SE -> {
|
||||
entityTopRow = (entity.boxTop() + entity.speed)/ Screen.TILE_SIZE;
|
||||
entityRightCol = (entity.boxRight() + entity.speed)/ Screen.TILE_SIZE;
|
||||
entityLeftCol = (entity.boxLeft() + entity.speed)/ Screen.TILE_SIZE;
|
||||
entityBottomRow = (entity.boxBottom() + entity.speed)/ Screen.TILE_SIZE;
|
||||
return isNonePassable(entityBottomRow, entityLeftCol, entityTopRow, entityRightCol);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isNonePassable(int row1, int col1, int row2, int col2) {
|
||||
int tileNum2 = world.mapTileNum[row1][col1];
|
||||
int tileNum1 = world.mapTileNum[row2][col2];
|
||||
|
||||
return world.tiles[tileNum1].isCollision() || world.tiles[tileNum2].isCollision();
|
||||
}
|
||||
}
|
||||
17
src/main/java/se/urmo/my2dgame/util/ImageUtil.java
Normal file
@ -0,0 +1,17 @@
|
||||
package se.urmo.my2dgame.util;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ImageUtil {
|
||||
public static BufferedImage loadImage(String name) {
|
||||
try {
|
||||
return ImageIO.read(Objects.requireNonNull(ImageUtil.class.getResourceAsStream(name)));
|
||||
}catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
src/main/resources/maps/map01.txt
Normal file
@ -0,0 +1,12 @@
|
||||
1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
|
||||
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
|
||||
1 0 0 0 0 0 2 2 0 0 0 0 0 0 0 1
|
||||
1 0 0 0 0 2 2 2 2 0 0 0 0 0 0 1
|
||||
1 0 0 0 0 2 2 2 2 0 0 0 0 0 0 1
|
||||
1 0 0 0 0 2 2 2 2 2 0 0 0 0 0 1
|
||||
1 0 0 0 0 2 2 2 2 0 0 0 0 0 0 1
|
||||
1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 1
|
||||
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
|
||||
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
|
||||
1 1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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
BIN
src/main/resources/objects/axe.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
src/main/resources/objects/blueheart.png
Normal file
|
After Width: | Height: | Size: 613 B |
BIN
src/main/resources/objects/boots.png
Normal file
|
After Width: | Height: | Size: 680 B |
BIN
src/main/resources/objects/chest (OLD).png
Normal file
|
After Width: | Height: | Size: 733 B |
BIN
src/main/resources/objects/chest.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
src/main/resources/objects/chest_opened.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
src/main/resources/objects/coin_bronze.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
src/main/resources/objects/door.png
Normal file
|
After Width: | Height: | Size: 638 B |
BIN
src/main/resources/objects/door_iron.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
src/main/resources/objects/heart_blank.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
src/main/resources/objects/heart_full.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
src/main/resources/objects/heart_half.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
src/main/resources/objects/key.png
Normal file
|
After Width: | Height: | Size: 711 B |
BIN
src/main/resources/objects/lantern.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
src/main/resources/objects/manacrystal_blank.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
src/main/resources/objects/manacrystal_full.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src/main/resources/objects/pickaxe.png
Normal file
|
After Width: | Height: | Size: 591 B |
BIN
src/main/resources/objects/potion_red.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
src/main/resources/objects/shield_blue.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
src/main/resources/objects/shield_wood.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
src/main/resources/objects/sword_normal.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
src/main/resources/objects/tent.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
src/main/resources/player/boy_down_1.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
src/main/resources/player/boy_down_2.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
src/main/resources/player/boy_left_1.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
src/main/resources/player/boy_left_2.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
src/main/resources/player/boy_right_1.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
src/main/resources/player/boy_right_2.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
src/main/resources/player/boy_up_1.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
src/main/resources/player/boy_up_2.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
src/main/resources/tiles/earth.png
Normal file
|
After Width: | Height: | Size: 614 B |
BIN
src/main/resources/tiles/grass.png
Normal file
|
After Width: | Height: | Size: 616 B |
BIN
src/main/resources/tiles/sand.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
src/main/resources/tiles/tree.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
src/main/resources/tiles/wall.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
src/main/resources/tiles/water.png
Normal file
|
After Width: | Height: | Size: 619 B |