diff --git a/.gitignore b/.gitignore
index 9154f4c..e79f6ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,26 +1,32 @@
-# ---> Java
-# Compiled class file
-*.class
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
-# Log file
-*.log
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.nar
-*.ear
-*.zip
-*.tar.gz
-*.rar
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-replay_pid*
+### 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/
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..7bc07ec
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,10 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Environment-dependent path to Maven home directory
+/mavenHomeManager.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..aa00ffa
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d61b968
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..7d709fb
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+ org.example
+ My2DGame
+ 1.0-SNAPSHOT
+
+
+ 21
+ 21
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/src/main/java/entity/Entity.java b/src/main/java/entity/Entity.java
new file mode 100644
index 0000000..477deaf
--- /dev/null
+++ b/src/main/java/entity/Entity.java
@@ -0,0 +1,21 @@
+package entity;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+public class Entity {
+ public int worldX;
+ public int worldY;
+ public int speed;
+
+ public BufferedImage up1, up2, down1, down2, left1, left2, right1, right2;
+ public String direction;
+
+ public int spriteCount = 0;
+ public int spriteNum = 1;
+
+ public Rectangle solidArea;
+ public int solidAreaDefaultX;
+ public int solidAreaDefaultY;
+ public boolean collisionOn = false;
+}
diff --git a/src/main/java/entity/Player.java b/src/main/java/entity/Player.java
new file mode 100644
index 0000000..1177301
--- /dev/null
+++ b/src/main/java/entity/Player.java
@@ -0,0 +1,144 @@
+package entity;
+
+import main.GamePanel;
+import main.KeyHandler;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.Objects;
+
+public class Player extends Entity {
+ private final GamePanel gamePanel;
+ private final KeyHandler keyHandler;
+
+ public final int screenX;
+ public final int screenY;
+
+ int hasKey = 0;
+
+ public Player(GamePanel gamePanel, KeyHandler keyHandler) {
+ this.gamePanel = gamePanel;
+ this.keyHandler = keyHandler;
+
+ screenX = gamePanel.screenWidth / 2 - (gamePanel.tileSize/2);
+ screenY = gamePanel.screenHeight / 2 - (gamePanel.tileSize/2);
+
+ solidArea = new Rectangle(8,16,32,32);
+ solidAreaDefaultX = solidArea.x;
+ solidAreaDefaultY = solidArea.y;
+
+ setDefaultValues();
+ getPlayerImage();
+
+ }
+
+ public void setDefaultValues(){
+ worldX = gamePanel.tileSize * 22;
+ worldY = gamePanel.tileSize * 22;
+ speed = 1;
+ direction = "down";
+ }
+
+ public void getPlayerImage(){
+ try {
+ up1 = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/player/boy_up_1.png")));
+ up2 = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/player/boy_up_2.png")));
+ down1 = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/player/boy_down_1.png")));
+ down2 = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/player/boy_down_2.png")));
+ left1 = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/player/boy_left_1.png")));
+ left2 = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/player/boy_left_2.png")));
+ right1 = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/player/boy_right_1.png")));
+ right2 = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/player/boy_right_2.png")));
+ }catch (IOException e){
+ e.printStackTrace();
+ }
+ }
+
+ public void update(){
+ if(keyHandler.upPressed || keyHandler.downPressed
+ || keyHandler.leftPressed || keyHandler.rightPressed) {
+ if (keyHandler.upPressed) {
+ direction = "up";
+ }
+ if (keyHandler.downPressed) {
+ direction = "down";
+ }
+ if (keyHandler.leftPressed) {
+ direction = "left";
+ }
+ if (keyHandler.rightPressed) {
+ direction = "right";
+ }
+
+ //Check tile collision
+ collisionOn = false;
+ gamePanel.collisionChecker.checkTile(gamePanel.player);
+ int objectIndex = gamePanel.collisionChecker.checkObject(this,true);
+ pickUpObject(objectIndex);
+ if(!collisionOn){
+ switch (direction){
+ case "up" -> worldY -= speed;
+ case "down" -> worldY += speed;
+ case "left" -> worldX -= speed;
+ case "right" -> worldX += speed;
+ }
+ }
+
+ spriteCount++;
+ if (spriteCount == 30) {
+ if (spriteNum == 1) {
+ spriteNum = 2;
+ } else if (spriteNum == 2) {
+ spriteNum = 1;
+ }
+ spriteCount = 0;
+ }
+ }
+ }
+
+ public void pickUpObject(int objectIndex){
+ if(objectIndex != 999){
+ String objectName = gamePanel.obj[objectIndex].name;
+ switch (objectName){
+ case "Key" -> {
+ gamePanel.playSE(1);
+ hasKey++;
+ gamePanel.obj[objectIndex] = null;
+ }
+ case "Door" -> {
+ if(hasKey > 0 ){
+ gamePanel.playSE(3);
+ gamePanel.obj[objectIndex] = null;
+ hasKey--;
+ }
+ }
+ case "Boots" -> {
+ gamePanel.playSE(2);
+ speed += 1;
+ gamePanel.obj[objectIndex] = null;
+ }
+ }
+ }
+ }
+
+ public void draw(Graphics2D g2d){
+ BufferedImage image = null;
+ switch(direction){
+ case "up" -> image = spriteNum == 1 ? up1 : up2;
+ case "down" -> image = spriteNum == 1 ? down1 : down2;
+ case "left" -> image = spriteNum == 1 ? left1 : left2;
+ case "right" -> image = spriteNum == 1 ? right1 : right2;
+ }
+
+ g2d.drawImage(image, screenX, screenY, gamePanel.tileSize, gamePanel.tileSize, null);
+ }
+
+ private void drawRectangel(Graphics2D g2d) {
+ int num = (worldX - 24) / gamePanel.tileSize;
+ int num2 = (worldY - 24) / gamePanel.tileSize;
+ g2d.drawRect(screenX - gamePanel.tileSize, screenY - gamePanel.tileSize, 48, 48);
+ g2d.drawString("" + num + "," + num2, screenX - gamePanel.tileSize + 10, screenY - gamePanel.tileSize + 20);
+ }
+}
diff --git a/src/main/java/main/AssetSetter.java b/src/main/java/main/AssetSetter.java
new file mode 100644
index 0000000..ff5a66a
--- /dev/null
+++ b/src/main/java/main/AssetSetter.java
@@ -0,0 +1,24 @@
+package main;
+
+import object.Boots;
+import object.Chest;
+import object.Door;
+import object.Key;
+
+public class AssetSetter {
+ GamePanel gamePanel;
+ public AssetSetter(GamePanel gamePanel) {
+ this.gamePanel = gamePanel;
+ }
+
+ public void setObject() {
+ gamePanel.obj[0] = new Key(23 * gamePanel.tileSize, 7 * gamePanel.tileSize);
+ gamePanel.obj[1] = new Key(23 * gamePanel.tileSize, 40 * gamePanel.tileSize);
+ gamePanel.obj[2] = new Key(38 * gamePanel.tileSize, 9 * gamePanel.tileSize);
+ gamePanel.obj[3] = new Door(10 * gamePanel.tileSize, 11 * gamePanel.tileSize);
+ gamePanel.obj[4] = new Door(8 * gamePanel.tileSize, 28 * gamePanel.tileSize);
+ gamePanel.obj[5] = new Door(12 * gamePanel.tileSize, 22 * gamePanel.tileSize);
+ gamePanel.obj[6] = new Chest(10 * gamePanel.tileSize, 7 * gamePanel.tileSize);
+ gamePanel.obj[7] = new Boots(37 * gamePanel.tileSize, 42 * gamePanel.tileSize);
+ }
+}
diff --git a/src/main/java/main/CollisionChecker.java b/src/main/java/main/CollisionChecker.java
new file mode 100644
index 0000000..5c98706
--- /dev/null
+++ b/src/main/java/main/CollisionChecker.java
@@ -0,0 +1,122 @@
+package main;
+
+import entity.Entity;
+
+public class CollisionChecker {
+
+ private final GamePanel gamePanel;
+
+ public CollisionChecker(GamePanel gamePanel) {
+ this.gamePanel = gamePanel;
+ }
+
+ public void checkTile(Entity entity) {
+ int entityLeftWorldX = entity.worldX + entity.solidArea.x;
+ int entityRightWorldX = entity.worldX + entity.solidArea.x + entity.solidArea.width;
+ int entityTopWorldY = entity.worldY + entity.solidArea.y;
+ int entityBottomWorldY = entity.worldY + entity.solidArea.y + entity.solidArea.height;
+
+ int entityLeftCol = entityLeftWorldX/gamePanel.tileSize;
+ int entityRightCol = entityRightWorldX/gamePanel.tileSize;
+ int entityTopRow = entityTopWorldY/gamePanel.tileSize;
+ int entityBottomRow = entityBottomWorldY/gamePanel.tileSize;
+
+ int tileNum1;
+ int tileNum2;
+
+ switch (entity.direction){
+ case "up" -> {
+ entityTopRow = (entityTopWorldY - entity.speed)/gamePanel.tileSize;
+ tileNum1 = gamePanel.tileManager.mapTileNum[entityTopRow][entityLeftCol];
+ tileNum2 = gamePanel.tileManager.mapTileNum[entityTopRow][entityRightCol];
+ if(gamePanel.tileManager.tiles[tileNum1].collission || gamePanel.tileManager.tiles[tileNum2].collission){
+ entity.collisionOn = true;
+ }
+ }
+ case "down" -> {
+ entityBottomRow = (entityBottomWorldY + entity.speed)/gamePanel.tileSize;
+ tileNum1 = gamePanel.tileManager.mapTileNum[entityBottomRow][entityLeftCol];
+ tileNum2 = gamePanel.tileManager.mapTileNum[entityBottomRow][entityRightCol];
+ if(gamePanel.tileManager.tiles[tileNum1].collission || gamePanel.tileManager.tiles[tileNum2].collission){
+ entity.collisionOn = true;
+ }
+ }
+ case "left" -> {
+ entityLeftCol = (entityLeftWorldX - entity.speed)/gamePanel.tileSize;
+ tileNum1 = gamePanel.tileManager.mapTileNum[entityTopRow][entityLeftCol];
+ tileNum2 = gamePanel.tileManager.mapTileNum[entityBottomRow][entityLeftCol];
+ if(gamePanel.tileManager.tiles[tileNum1].collission || gamePanel.tileManager.tiles[tileNum2].collission){
+ entity.collisionOn = true;
+ }
+ }
+ case "right" -> {
+ entityRightCol = (entityRightWorldX + entity.speed)/gamePanel.tileSize;
+ tileNum1 = gamePanel.tileManager.mapTileNum[entityTopRow][entityRightCol];
+ tileNum2 = gamePanel.tileManager.mapTileNum[entityBottomRow][entityRightCol];
+ if(gamePanel.tileManager.tiles[tileNum1].collission || gamePanel.tileManager.tiles[tileNum2].collission){
+ entity.collisionOn = true;
+ }
+ }
+ }
+ }
+ public int checkObject(Entity entity, boolean player) {
+ int index = 999;
+ for (int i = 0; i < gamePanel.obj.length; i++) {
+ if(gamePanel.obj[i] != null){
+ entity.solidArea.x = entity.worldX + entity.solidArea.x;
+ entity.solidArea.y = entity.worldY + entity.solidArea.y;
+ gamePanel.obj[i].solidArea.x = gamePanel.obj[i].worldX + gamePanel.obj[i].solidArea.x;
+ gamePanel.obj[i].solidArea.y = gamePanel.obj[i].worldY + gamePanel.obj[i].solidArea.y;
+
+ switch (entity.direction){
+ case "up" -> {
+ entity.solidArea.y -= entity.speed;
+ if(entity.solidArea.intersects(gamePanel.obj[i].solidArea)){
+ if(gamePanel.obj[i].collision){
+ entity.collisionOn = true;
+ }
+ if(player){
+ index = i;
+ }
+ }
+ }
+ case "down" -> {
+ entity.solidArea.y += entity.speed;
+ if(entity.solidArea.intersects(gamePanel.obj[i].solidArea)){
+ if(gamePanel.obj[i].collision){
+ entity.collisionOn = true;
+ }
+ if(player){
+ index = i;
+ } }
+ }
+ case "left" -> {
+ entity.solidArea.x -= entity.speed;
+ if(entity.solidArea.intersects(gamePanel.obj[i].solidArea)){
+ if(gamePanel.obj[i].collision){
+ entity.collisionOn = true;
+ }
+ if(player){
+ index = i;
+ } }
+ }
+ case "right" -> {
+ entity.solidArea.x += entity.speed;
+ if(entity.solidArea.intersects(gamePanel.obj[i].solidArea)){
+ if(gamePanel.obj[i].collision){
+ entity.collisionOn = true;
+ }
+ if(player){
+ index = i;
+ } }
+ }
+ }
+ entity.solidArea.x = entity.solidAreaDefaultX;
+ entity.solidArea.y = entity.solidAreaDefaultY;
+ gamePanel.obj[i].solidArea.x = gamePanel.obj[i].solidAreaDefaultX;
+ gamePanel.obj[i].solidArea.y = gamePanel.obj[i].solidAreaDefaultY;
+ }
+ }
+ return index;
+ }
+}
diff --git a/src/main/java/main/GamePanel.java b/src/main/java/main/GamePanel.java
new file mode 100644
index 0000000..42f7a94
--- /dev/null
+++ b/src/main/java/main/GamePanel.java
@@ -0,0 +1,126 @@
+package main;
+
+import entity.Player;
+import object.SuperObject;
+import tile.TileManager;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Arrays;
+import java.util.Objects;
+
+public class GamePanel extends JPanel 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;
+
+ //SCREEN SETTINGS
+ int originalTileSize = 16;
+ int scale = 3;
+ public int tileSize = originalTileSize * scale;
+ public int maxScreenCol = 16;
+ public int maxScreenRow = 12;
+ public int screenWidth = maxScreenCol * tileSize;
+ public int screenHeight = maxScreenRow * tileSize;
+
+ //WORLD
+ public final int maxWorldCol = 50;
+ public final int maxWorldRow = 50;
+
+ // SYSTEM
+ TileManager tileManager = new TileManager(this);
+ KeyHandler keyHandler = new KeyHandler();
+ Sound sound = new Sound();
+ public CollisionChecker collisionChecker = new CollisionChecker(this);
+ public AssetSetter assetSetter = new AssetSetter(this);
+ Thread gameThread;
+
+ //ENTITY AND OBJECT
+ public Player player = new Player(this, keyHandler);
+ public SuperObject[] obj = new SuperObject[10];
+
+ public GamePanel() {
+ this.setPreferredSize(new Dimension(screenWidth, screenHeight));
+ this.setBackground(Color.BLACK);
+ this.setDoubleBuffered(true);
+ this.addKeyListener(keyHandler);
+ this.setFocusable(true);
+ }
+
+ public void setupGame(){
+ assetSetter.setObject();
+ playMusic(0);
+ }
+
+ public void startGameThread() {
+ this.gameThread = new Thread(this);
+ gameThread.start();
+ }
+ public void update(){
+ player.update();
+ }
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ Graphics2D g2d = (Graphics2D) g;
+
+ tileManager.draw(g2d);
+ Arrays.stream(obj)
+ .filter(Objects::nonNull)
+ .forEach(o -> o.draw(g2d, this));
+ player.draw(g2d);
+ g2d.dispose();
+ }
+
+ public void playMusic(int i) {
+ sound.setFile(i);
+ sound.play();
+ sound.loop();
+ }
+ public void stopMusic() {
+ sound.stop();
+ }
+ public void playSE(int i) {
+ sound.setFile(i);
+ sound.play();
+ }
+
+ @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) {
+ update();
+ updates++;
+ deltaU--;
+ }
+
+ if (deltaF >= 1) {
+ repaint();
+ frames++;
+ deltaF--;
+ }
+
+ if (System.currentTimeMillis() - lastCheck >= 1000) {
+ lastCheck = System.currentTimeMillis();
+ System.out.println("FPS: " + frames + " | UPS: " + updates);
+ frames = 0;
+ updates = 0;
+ }
+ }
+ }
+}
diff --git a/src/main/java/main/KeyHandler.java b/src/main/java/main/KeyHandler.java
new file mode 100644
index 0000000..c03ce8d
--- /dev/null
+++ b/src/main/java/main/KeyHandler.java
@@ -0,0 +1,48 @@
+package 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;
+ }
+ }
+}
diff --git a/src/main/java/main/Main.java b/src/main/java/main/Main.java
new file mode 100644
index 0000000..b2e12ac
--- /dev/null
+++ b/src/main/java/main/Main.java
@@ -0,0 +1,23 @@
+package main;
+
+import javax.swing.*;
+
+public class Main {
+ public static void main(String[] args) {
+ JFrame window = new JFrame();
+ window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ window.setResizable(false);
+ window.setTitle("2d");
+
+ GamePanel gamePanel = new GamePanel();
+ window.add(gamePanel);
+
+ window.pack();
+
+ window.setLocationRelativeTo(null);
+ window.setVisible(true);
+
+ gamePanel.setupGame();
+ gamePanel.startGameThread();
+ }
+}
diff --git a/src/main/java/main/Sound.java b/src/main/java/main/Sound.java
new file mode 100644
index 0000000..436e2fb
--- /dev/null
+++ b/src/main/java/main/Sound.java
@@ -0,0 +1,36 @@
+package main;
+
+import javax.sound.sampled.*;
+import java.io.IOException;
+import java.net.URL;
+
+public class Sound {
+ Clip clip;
+ URL[] soundUrl = new URL[30];
+
+ public Sound() {
+ soundUrl[0] = Sound.class.getResource("/sound/BlueBoyAdventure.wav");
+ soundUrl[1] = Sound.class.getResource("/sound/coin.wav");
+ soundUrl[2] = Sound.class.getResource("/sound/powerup.wav");
+ soundUrl[3] = Sound.class.getResource("/sound/unlock.wav");
+ soundUrl[4] = Sound.class.getResource("/sound/fanfare.wav");
+ }
+ public void setFile(int i){
+ try {
+ AudioInputStream ais = AudioSystem.getAudioInputStream(soundUrl[i]);
+ clip = AudioSystem.getClip();
+ clip.open(ais);
+ } catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) {
+ e.printStackTrace();
+ }
+ }
+ public void play() {
+ clip.start();
+ }
+ public void loop() {
+ clip.loop(Clip.LOOP_CONTINUOUSLY);
+ }
+ public void stop() {
+ clip.stop();
+ }
+}
diff --git a/src/main/java/object/Boots.java b/src/main/java/object/Boots.java
new file mode 100644
index 0000000..df91c4a
--- /dev/null
+++ b/src/main/java/object/Boots.java
@@ -0,0 +1,18 @@
+package object;
+
+import javax.imageio.ImageIO;
+import java.io.IOException;
+
+public class Boots extends SuperObject{
+ public Boots(int x, int y) {
+ name = "Boots";
+ worldX = x;
+ worldY = y;
+
+ try{
+ image = ImageIO.read(getClass().getResourceAsStream("/objects/boots.png"));
+ }catch(IOException e){
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/object/Chest.java b/src/main/java/object/Chest.java
new file mode 100644
index 0000000..7370dc7
--- /dev/null
+++ b/src/main/java/object/Chest.java
@@ -0,0 +1,18 @@
+package object;
+
+import javax.imageio.ImageIO;
+import java.io.IOException;
+
+public class Chest extends SuperObject{
+ public Chest(int x, int y) {
+ name = "Chest";
+ worldX = x;
+ worldY = y;
+
+ try{
+ image = ImageIO.read(getClass().getResourceAsStream("/objects/chest.png"));
+ }catch(IOException e){
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/object/Door.java b/src/main/java/object/Door.java
new file mode 100644
index 0000000..01079b0
--- /dev/null
+++ b/src/main/java/object/Door.java
@@ -0,0 +1,19 @@
+package object;
+
+import javax.imageio.ImageIO;
+import java.io.IOException;
+
+public class Door extends SuperObject{
+ public Door(int x, int y) {
+ name = "Door";
+ worldX = x;
+ worldY = y;
+
+ try{
+ image = ImageIO.read(getClass().getResourceAsStream("/objects/door.png"));
+ }catch(IOException e){
+ e.printStackTrace();
+ }
+ collision = true;
+ }
+}
diff --git a/src/main/java/object/Key.java b/src/main/java/object/Key.java
new file mode 100644
index 0000000..087b4d6
--- /dev/null
+++ b/src/main/java/object/Key.java
@@ -0,0 +1,18 @@
+package 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();
+ }
+ }
+}
diff --git a/src/main/java/object/SuperObject.java b/src/main/java/object/SuperObject.java
new file mode 100644
index 0000000..92f39ae
--- /dev/null
+++ b/src/main/java/object/SuperObject.java
@@ -0,0 +1,29 @@
+package object;
+
+import main.GamePanel;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+public class SuperObject {
+ public String name;
+ public BufferedImage image;
+ public boolean collision = false;
+ public int worldX;
+ public int worldY;
+ public Rectangle solidArea = new Rectangle(0,0,48,48);
+ public int solidAreaDefaultX = 0;
+ public int solidAreaDefaultY = 0;
+
+ public void draw(Graphics2D g2d, GamePanel gamePanel) {
+ // Only drawImage for tiles within camera
+ if (worldX + gamePanel.tileSize> gamePanel.player.worldX - gamePanel.player.screenX &&
+ worldX -gamePanel.tileSize < gamePanel.player.worldX + gamePanel.player.screenX &&
+ worldY + gamePanel.tileSize > gamePanel.player.worldY - gamePanel.player.screenY &&
+ worldY - gamePanel.tileSize < gamePanel.player.worldY + gamePanel.player.screenY) {
+ int screenX = worldX - gamePanel.player.worldX + gamePanel.player.screenX;
+ int screenY = worldY - gamePanel.player.worldY + gamePanel.player.screenY;
+ g2d.drawImage(image, screenX, screenY, gamePanel.tileSize, gamePanel.tileSize, null);
+ }
+ }
+}
diff --git a/src/main/java/tile/Tile.java b/src/main/java/tile/Tile.java
new file mode 100644
index 0000000..e35bd65
--- /dev/null
+++ b/src/main/java/tile/Tile.java
@@ -0,0 +1,8 @@
+package tile;
+
+import java.awt.image.BufferedImage;
+
+public class Tile {
+ public BufferedImage image;
+ public boolean collission = false;
+}
diff --git a/src/main/java/tile/TileManager.java b/src/main/java/tile/TileManager.java
new file mode 100644
index 0000000..9751e70
--- /dev/null
+++ b/src/main/java/tile/TileManager.java
@@ -0,0 +1,99 @@
+package tile;
+
+import main.GamePanel;
+
+import javax.imageio.ImageIO;
+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 TileManager {
+ GamePanel gp;
+ public Tile[] tiles = new Tile[10];
+ public int[][] mapTileNum;
+
+ public TileManager(GamePanel gp) {
+ this.gp = gp;
+ getTileImage();
+ this.mapTileNum = loadMap("/maps/world01.txt");
+ }
+
+ public int[][] loadMap(String path) {
+ int[][] map = new int[gp.maxWorldRow][gp.maxWorldCol];
+ try {
+ InputStream stream = GamePanel.class.getResourceAsStream(path);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
+ int row = 0;
+ String line;
+ while ((line = reader.readLine()) != null && row < gp.maxWorldRow) {
+ map[row++] = Arrays.stream(line.split(" "))
+ .mapToInt(Integer::parseInt)
+ .toArray();
+ }
+ reader.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return map;
+ }
+
+ public void getTileImage() {
+ try {
+ tiles[0] = new Tile();
+ tiles[0].image = ImageIO.read(GamePanel.class.getResourceAsStream("/tiles/grass.png"));
+
+ tiles[1] = new Tile();
+ tiles[1].image = ImageIO.read(GamePanel.class.getResourceAsStream("/tiles/wall.png"));
+ tiles[1].collission = true;
+
+ tiles[2] = new Tile();
+ tiles[2].image = ImageIO.read(GamePanel.class.getResourceAsStream("/tiles/water.png"));
+ tiles[2].collission = true;
+
+ tiles[3] = new Tile();
+ tiles[3].image = ImageIO.read(GamePanel.class.getResourceAsStream("/tiles/earth.png"));
+
+ tiles[4] = new Tile();
+ tiles[4].image = ImageIO.read(GamePanel.class.getResourceAsStream("/tiles/tree.png"));
+ tiles[4].collission = true;
+
+ tiles[5] = new Tile();
+ tiles[5].image = ImageIO.read(GamePanel.class.getResourceAsStream("/tiles/sand.png"));
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void draw(Graphics2D g2d) {
+ int worldCol = 0;
+ int worldRow = 0;
+
+ while (worldCol < gp.maxWorldCol && worldRow < gp.maxWorldRow) {
+ int tileNum = mapTileNum[worldRow][worldCol];
+
+ int worldX = worldCol * gp.tileSize;
+ int worldY = worldRow * gp.tileSize;
+
+ // Only drawImage for tiles within camera
+ if (worldX + gp.tileSize> gp.player.worldX - gp.player.screenX &&
+ worldX -gp.tileSize < gp.player.worldX + gp.player.screenX &&
+ worldY + gp.tileSize > gp.player.worldY - gp.player.screenY &&
+ worldY - gp.tileSize < gp.player.worldY + gp.player.screenY) {
+ int screenX = worldX - gp.player.worldX + gp.player.screenX;
+ int screenY = worldY - gp.player.worldY + gp.player.screenY;
+ g2d.drawImage(tiles[tileNum].image, screenX, screenY, gp.tileSize, gp.tileSize, null);
+ }
+
+ worldCol++;
+
+ if (worldCol == gp.maxWorldCol) {
+ worldCol = 0;
+ worldRow++;
+ }
+ }
+ }
+}
diff --git a/src/main/resources/maps/map01.txt b/src/main/resources/maps/map01.txt
new file mode 100644
index 0000000..e140f93
--- /dev/null
+++ b/src/main/resources/maps/map01.txt
@@ -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 1 0 0 1 1 1 1 1 1 1 1 1 1 1
\ No newline at end of file
diff --git a/src/main/resources/maps/world01.txt b/src/main/resources/maps/world01.txt
new file mode 100644
index 0000000..6a4e575
--- /dev/null
+++ b/src/main/resources/maps/world01.txt
@@ -0,0 +1,50 @@
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 2 2 2 2 2 0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+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4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
\ No newline at end of file
diff --git a/src/main/resources/maps/world02.txt b/src/main/resources/maps/world02.txt
new file mode 100644
index 0000000..81681ac
--- /dev/null
+++ b/src/main/resources/maps/world02.txt
@@ -0,0 +1,50 @@
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0
+4 4 4 4 4 4 4 4 4 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
+4 4 4 4 4 4 4 4 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0 0 0
+4 4 4 4 4 4 4 4 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0
+4 4 4 4 4 4 4 4 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 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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 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
\ No newline at end of file
diff --git a/src/main/resources/objects/axe.png b/src/main/resources/objects/axe.png
new file mode 100644
index 0000000..68fc0a5
Binary files /dev/null and b/src/main/resources/objects/axe.png differ
diff --git a/src/main/resources/objects/blueheart.png b/src/main/resources/objects/blueheart.png
new file mode 100644
index 0000000..6441848
Binary files /dev/null and b/src/main/resources/objects/blueheart.png differ
diff --git a/src/main/resources/objects/boots.png b/src/main/resources/objects/boots.png
new file mode 100644
index 0000000..d75f642
Binary files /dev/null and b/src/main/resources/objects/boots.png differ
diff --git a/src/main/resources/objects/chest (OLD).png b/src/main/resources/objects/chest (OLD).png
new file mode 100644
index 0000000..d257eee
Binary files /dev/null and b/src/main/resources/objects/chest (OLD).png differ
diff --git a/src/main/resources/objects/chest.png b/src/main/resources/objects/chest.png
new file mode 100644
index 0000000..64e06cd
Binary files /dev/null and b/src/main/resources/objects/chest.png differ
diff --git a/src/main/resources/objects/chest_opened.png b/src/main/resources/objects/chest_opened.png
new file mode 100644
index 0000000..a600892
Binary files /dev/null and b/src/main/resources/objects/chest_opened.png differ
diff --git a/src/main/resources/objects/coin_bronze.png b/src/main/resources/objects/coin_bronze.png
new file mode 100644
index 0000000..938ae36
Binary files /dev/null and b/src/main/resources/objects/coin_bronze.png differ
diff --git a/src/main/resources/objects/door.png b/src/main/resources/objects/door.png
new file mode 100644
index 0000000..589a559
Binary files /dev/null and b/src/main/resources/objects/door.png differ
diff --git a/src/main/resources/objects/door_iron.png b/src/main/resources/objects/door_iron.png
new file mode 100644
index 0000000..24e699e
Binary files /dev/null and b/src/main/resources/objects/door_iron.png differ
diff --git a/src/main/resources/objects/heart_blank.png b/src/main/resources/objects/heart_blank.png
new file mode 100644
index 0000000..a26c81b
Binary files /dev/null and b/src/main/resources/objects/heart_blank.png differ
diff --git a/src/main/resources/objects/heart_full.png b/src/main/resources/objects/heart_full.png
new file mode 100644
index 0000000..4097771
Binary files /dev/null and b/src/main/resources/objects/heart_full.png differ
diff --git a/src/main/resources/objects/heart_half.png b/src/main/resources/objects/heart_half.png
new file mode 100644
index 0000000..42224ad
Binary files /dev/null and b/src/main/resources/objects/heart_half.png differ
diff --git a/src/main/resources/objects/key.png b/src/main/resources/objects/key.png
new file mode 100644
index 0000000..6aabbc6
Binary files /dev/null and b/src/main/resources/objects/key.png differ
diff --git a/src/main/resources/objects/lantern.png b/src/main/resources/objects/lantern.png
new file mode 100644
index 0000000..6843fcf
Binary files /dev/null and b/src/main/resources/objects/lantern.png differ
diff --git a/src/main/resources/objects/manacrystal_blank.png b/src/main/resources/objects/manacrystal_blank.png
new file mode 100644
index 0000000..057c189
Binary files /dev/null and b/src/main/resources/objects/manacrystal_blank.png differ
diff --git a/src/main/resources/objects/manacrystal_full.png b/src/main/resources/objects/manacrystal_full.png
new file mode 100644
index 0000000..322ecd4
Binary files /dev/null and b/src/main/resources/objects/manacrystal_full.png differ
diff --git a/src/main/resources/objects/pickaxe.png b/src/main/resources/objects/pickaxe.png
new file mode 100644
index 0000000..8435424
Binary files /dev/null and b/src/main/resources/objects/pickaxe.png differ
diff --git a/src/main/resources/objects/potion_red.png b/src/main/resources/objects/potion_red.png
new file mode 100644
index 0000000..eab1816
Binary files /dev/null and b/src/main/resources/objects/potion_red.png differ
diff --git a/src/main/resources/objects/shield_blue.png b/src/main/resources/objects/shield_blue.png
new file mode 100644
index 0000000..6ef2cac
Binary files /dev/null and b/src/main/resources/objects/shield_blue.png differ
diff --git a/src/main/resources/objects/shield_wood.png b/src/main/resources/objects/shield_wood.png
new file mode 100644
index 0000000..25d2dda
Binary files /dev/null and b/src/main/resources/objects/shield_wood.png differ
diff --git a/src/main/resources/objects/sword_normal.png b/src/main/resources/objects/sword_normal.png
new file mode 100644
index 0000000..666952d
Binary files /dev/null and b/src/main/resources/objects/sword_normal.png differ
diff --git a/src/main/resources/objects/tent.png b/src/main/resources/objects/tent.png
new file mode 100644
index 0000000..bd9ef7b
Binary files /dev/null and b/src/main/resources/objects/tent.png differ
diff --git a/src/main/resources/player/boy_down_1.png b/src/main/resources/player/boy_down_1.png
new file mode 100644
index 0000000..4807748
Binary files /dev/null and b/src/main/resources/player/boy_down_1.png differ
diff --git a/src/main/resources/player/boy_down_2.png b/src/main/resources/player/boy_down_2.png
new file mode 100644
index 0000000..0ff298c
Binary files /dev/null and b/src/main/resources/player/boy_down_2.png differ
diff --git a/src/main/resources/player/boy_left_1.png b/src/main/resources/player/boy_left_1.png
new file mode 100644
index 0000000..85d10ad
Binary files /dev/null and b/src/main/resources/player/boy_left_1.png differ
diff --git a/src/main/resources/player/boy_left_2.png b/src/main/resources/player/boy_left_2.png
new file mode 100644
index 0000000..92f39a8
Binary files /dev/null and b/src/main/resources/player/boy_left_2.png differ
diff --git a/src/main/resources/player/boy_right_1.png b/src/main/resources/player/boy_right_1.png
new file mode 100644
index 0000000..247ecea
Binary files /dev/null and b/src/main/resources/player/boy_right_1.png differ
diff --git a/src/main/resources/player/boy_right_2.png b/src/main/resources/player/boy_right_2.png
new file mode 100644
index 0000000..4628500
Binary files /dev/null and b/src/main/resources/player/boy_right_2.png differ
diff --git a/src/main/resources/player/boy_up_1.png b/src/main/resources/player/boy_up_1.png
new file mode 100644
index 0000000..eb81fe2
Binary files /dev/null and b/src/main/resources/player/boy_up_1.png differ
diff --git a/src/main/resources/player/boy_up_2.png b/src/main/resources/player/boy_up_2.png
new file mode 100644
index 0000000..8bc797a
Binary files /dev/null and b/src/main/resources/player/boy_up_2.png differ
diff --git a/src/main/resources/sound/BlueBoyAdventure.wav b/src/main/resources/sound/BlueBoyAdventure.wav
new file mode 100644
index 0000000..0d8d630
Binary files /dev/null and b/src/main/resources/sound/BlueBoyAdventure.wav differ
diff --git a/src/main/resources/sound/Dungeon.wav b/src/main/resources/sound/Dungeon.wav
new file mode 100644
index 0000000..a358730
Binary files /dev/null and b/src/main/resources/sound/Dungeon.wav differ
diff --git a/src/main/resources/sound/FinalBattle.wav b/src/main/resources/sound/FinalBattle.wav
new file mode 100644
index 0000000..e2c652e
Binary files /dev/null and b/src/main/resources/sound/FinalBattle.wav differ
diff --git a/src/main/resources/sound/Merchant.wav b/src/main/resources/sound/Merchant.wav
new file mode 100644
index 0000000..4593d3d
Binary files /dev/null and b/src/main/resources/sound/Merchant.wav differ
diff --git a/src/main/resources/sound/blocked.wav b/src/main/resources/sound/blocked.wav
new file mode 100644
index 0000000..11c3cdd
Binary files /dev/null and b/src/main/resources/sound/blocked.wav differ
diff --git a/src/main/resources/sound/burning.wav b/src/main/resources/sound/burning.wav
new file mode 100644
index 0000000..28803ca
Binary files /dev/null and b/src/main/resources/sound/burning.wav differ
diff --git a/src/main/resources/sound/chipwall.wav b/src/main/resources/sound/chipwall.wav
new file mode 100644
index 0000000..547500d
Binary files /dev/null and b/src/main/resources/sound/chipwall.wav differ
diff --git a/src/main/resources/sound/coin.wav b/src/main/resources/sound/coin.wav
new file mode 100644
index 0000000..777c959
Binary files /dev/null and b/src/main/resources/sound/coin.wav differ
diff --git a/src/main/resources/sound/cursor.wav b/src/main/resources/sound/cursor.wav
new file mode 100644
index 0000000..9fd44b3
Binary files /dev/null and b/src/main/resources/sound/cursor.wav differ
diff --git a/src/main/resources/sound/cuttree.wav b/src/main/resources/sound/cuttree.wav
new file mode 100644
index 0000000..08e5ea0
Binary files /dev/null and b/src/main/resources/sound/cuttree.wav differ
diff --git a/src/main/resources/sound/dooropen.wav b/src/main/resources/sound/dooropen.wav
new file mode 100644
index 0000000..d54c1e5
Binary files /dev/null and b/src/main/resources/sound/dooropen.wav differ
diff --git a/src/main/resources/sound/fanfare.wav b/src/main/resources/sound/fanfare.wav
new file mode 100644
index 0000000..4690a59
Binary files /dev/null and b/src/main/resources/sound/fanfare.wav differ
diff --git a/src/main/resources/sound/gameover.wav b/src/main/resources/sound/gameover.wav
new file mode 100644
index 0000000..cd7dfe9
Binary files /dev/null and b/src/main/resources/sound/gameover.wav differ
diff --git a/src/main/resources/sound/hitmonster.wav b/src/main/resources/sound/hitmonster.wav
new file mode 100644
index 0000000..353e7f7
Binary files /dev/null and b/src/main/resources/sound/hitmonster.wav differ
diff --git a/src/main/resources/sound/levelup.wav b/src/main/resources/sound/levelup.wav
new file mode 100644
index 0000000..a6f6a82
Binary files /dev/null and b/src/main/resources/sound/levelup.wav differ
diff --git a/src/main/resources/sound/parry.wav b/src/main/resources/sound/parry.wav
new file mode 100644
index 0000000..a33ca3a
Binary files /dev/null and b/src/main/resources/sound/parry.wav differ
diff --git a/src/main/resources/sound/powerup.wav b/src/main/resources/sound/powerup.wav
new file mode 100644
index 0000000..107dafa
Binary files /dev/null and b/src/main/resources/sound/powerup.wav differ
diff --git a/src/main/resources/sound/receivedamage.wav b/src/main/resources/sound/receivedamage.wav
new file mode 100644
index 0000000..20bc8fa
Binary files /dev/null and b/src/main/resources/sound/receivedamage.wav differ
diff --git a/src/main/resources/sound/sleep.wav b/src/main/resources/sound/sleep.wav
new file mode 100644
index 0000000..a001f89
Binary files /dev/null and b/src/main/resources/sound/sleep.wav differ
diff --git a/src/main/resources/sound/speak.wav b/src/main/resources/sound/speak.wav
new file mode 100644
index 0000000..06a6274
Binary files /dev/null and b/src/main/resources/sound/speak.wav differ
diff --git a/src/main/resources/sound/stairs.wav b/src/main/resources/sound/stairs.wav
new file mode 100644
index 0000000..e71bb45
Binary files /dev/null and b/src/main/resources/sound/stairs.wav differ
diff --git a/src/main/resources/sound/unlock.wav b/src/main/resources/sound/unlock.wav
new file mode 100644
index 0000000..afecc5b
Binary files /dev/null and b/src/main/resources/sound/unlock.wav differ
diff --git a/src/main/resources/tiles/earth.png b/src/main/resources/tiles/earth.png
new file mode 100644
index 0000000..9255b38
Binary files /dev/null and b/src/main/resources/tiles/earth.png differ
diff --git a/src/main/resources/tiles/grass.png b/src/main/resources/tiles/grass.png
new file mode 100644
index 0000000..8a1892f
Binary files /dev/null and b/src/main/resources/tiles/grass.png differ
diff --git a/src/main/resources/tiles/sand.png b/src/main/resources/tiles/sand.png
new file mode 100644
index 0000000..10971d4
Binary files /dev/null and b/src/main/resources/tiles/sand.png differ
diff --git a/src/main/resources/tiles/tree.png b/src/main/resources/tiles/tree.png
new file mode 100644
index 0000000..b0d91ba
Binary files /dev/null and b/src/main/resources/tiles/tree.png differ
diff --git a/src/main/resources/tiles/wall.png b/src/main/resources/tiles/wall.png
new file mode 100644
index 0000000..d5f04bf
Binary files /dev/null and b/src/main/resources/tiles/wall.png differ
diff --git a/src/main/resources/tiles/water.png b/src/main/resources/tiles/water.png
new file mode 100644
index 0000000..7f48fd6
Binary files /dev/null and b/src/main/resources/tiles/water.png differ