├── .vscode ├── ipch │ ├── 977087a4c1e9bf46 │ │ ├── RUN.ipch │ │ └── mmap_address.bin │ └── f27903df2b35b70b │ │ ├── BUILD.ipch │ │ └── mmap_address.bin ├── launch.json └── settings.json ├── Decay.code-workspace ├── LICENSE ├── README.md ├── game-decay ├── .editorconfig ├── .gitattributes ├── .gitignore ├── .travis.yml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── zerulus │ │ │ └── game │ │ │ ├── GameLauncher.java │ │ │ ├── GamePanel.java │ │ │ ├── Window.java │ │ │ ├── entity │ │ │ ├── Enemy.java │ │ │ ├── Entity.java │ │ │ ├── GameObject.java │ │ │ ├── Gathers.java │ │ │ ├── Player.java │ │ │ ├── enemy │ │ │ │ └── TinyMon.java │ │ │ └── material │ │ │ │ ├── Material.java │ │ │ │ └── MaterialManager.java │ │ │ ├── graphics │ │ │ ├── Animation.java │ │ │ ├── Font.java │ │ │ ├── Fontf.java │ │ │ ├── Sprite.java │ │ │ └── SpriteSheet.java │ │ │ ├── math │ │ │ ├── AABB.java │ │ │ ├── Matrix.java │ │ │ └── Vector2f.java │ │ │ ├── noise │ │ │ ├── SimplexNoise.java │ │ │ └── SimplexNoise_octave.java │ │ │ ├── states │ │ │ ├── EditState.java │ │ │ ├── GameOverState.java │ │ │ ├── GameState.java │ │ │ ├── GameStateManager.java │ │ │ ├── MenuState.java │ │ │ ├── PauseState.java │ │ │ ├── PlayState.java │ │ │ └── levels │ │ │ │ └── Save.java │ │ │ ├── tiles │ │ │ ├── TileManager.java │ │ │ ├── TileMap.java │ │ │ ├── TileMapGenerator.java │ │ │ ├── TileMapNorm.java │ │ │ ├── TileMapObj.java │ │ │ └── blocks │ │ │ │ ├── Block.java │ │ │ │ ├── HoleBlock.java │ │ │ │ ├── NormBlock.java │ │ │ │ └── ObjBlock.java │ │ │ ├── ui │ │ │ ├── BuildOptionUI.java │ │ │ ├── Button.java │ │ │ ├── ClickedEvent.java │ │ │ ├── FillBars.java │ │ │ ├── PlayerUI.java │ │ │ └── Slots.java │ │ │ └── util │ │ │ ├── AABBTree.java │ │ │ ├── Camera.java │ │ │ ├── GameObjectHeap.java │ │ │ ├── GameObjectKey.java │ │ │ ├── KeyHandler.java │ │ │ ├── MouseHandler.java │ │ │ └── TileCollision.java │ └── resources │ │ ├── building │ │ ├── Sprites │ │ │ ├── CitizenSheet.png │ │ │ ├── Smoke0000.png │ │ │ ├── Smoke0001.png │ │ │ ├── Smoke0002.png │ │ │ ├── buttons0000.png │ │ │ ├── buttons0001.png │ │ │ ├── buttons0002.png │ │ │ ├── buttons0003.png │ │ │ ├── buttons0004.png │ │ │ ├── buttons0005.png │ │ │ ├── buttons0006.png │ │ │ ├── buttons0007.png │ │ │ ├── buttons0008.png │ │ │ ├── buttons0009.png │ │ │ ├── buttons0010.png │ │ │ ├── buttons0011.png │ │ │ ├── buttons0012.png │ │ │ ├── buttons0013.png │ │ │ ├── buttons0014.png │ │ │ ├── buttons0015.png │ │ │ ├── castle.png │ │ │ ├── chapel.png │ │ │ ├── clock.png │ │ │ ├── crops.png │ │ │ ├── dirt.png │ │ │ ├── firtree.png │ │ │ ├── fish.png │ │ │ ├── fruit.png │ │ │ ├── house.png │ │ │ ├── inn.png │ │ │ ├── marblepath.png │ │ │ ├── newgrass.png │ │ │ ├── oaktree.png │ │ │ ├── pinetree.png │ │ │ ├── preview.png │ │ │ ├── tailor.png │ │ │ ├── tavern.png │ │ │ ├── thatched.png │ │ │ ├── treehouse.png │ │ │ ├── villa.png │ │ │ ├── wal0000.png │ │ │ ├── wal0001.png │ │ │ ├── wal0002.png │ │ │ ├── wal0003.png │ │ │ ├── wal0004.png │ │ │ ├── wal0005.png │ │ │ ├── wal0006.png │ │ │ ├── wal0007.png │ │ │ ├── wal0008.png │ │ │ ├── wal0009.png │ │ │ ├── wal0010.png │ │ │ └── watchtower.png │ │ ├── buildings.png │ │ ├── iso-64x64-building.png │ │ └── jpisotbs.png │ │ ├── entity │ │ ├── enemy │ │ │ ├── Dwarf_Sprite_Sheet1.2v.png │ │ │ ├── Minotaur - Sprite Sheet.png │ │ │ ├── bigmonster.png │ │ │ ├── flaming skull design.png │ │ │ ├── goblin spritesheet calciumtrice.png │ │ │ ├── littlegirl.png │ │ │ ├── minimonsters.png │ │ │ ├── monsters.png │ │ │ ├── orc spritesheet calciumtrice.png │ │ │ └── skeleton spritesheet calciumtrice.png │ │ ├── linkformatted.png │ │ ├── littlegirl.png │ │ ├── references │ │ │ ├── link.png │ │ │ ├── player_referrence.png │ │ │ └── rogue like character │ │ │ │ ├── rogue like attack animations.png │ │ │ │ ├── rogue like attack animations_attack down_0.png │ │ │ │ ├── rogue like attack animations_attack down_1.png │ │ │ │ ├── rogue like attack animations_attack down_2.png │ │ │ │ ├── rogue like attack animations_attack down_3.png │ │ │ │ ├── rogue like attack animations_attack left_0.png │ │ │ │ ├── rogue like attack animations_attack left_1.png │ │ │ │ ├── rogue like attack animations_attack left_2.png │ │ │ │ ├── rogue like attack animations_attack left_3.png │ │ │ │ ├── rogue like attack animations_attack right_0.png │ │ │ │ ├── rogue like attack animations_attack right_1.png │ │ │ │ ├── rogue like attack animations_attack right_2.png │ │ │ │ ├── rogue like attack animations_attack right_3.png │ │ │ │ ├── rogue like attack animations_attack up_0.png │ │ │ │ ├── rogue like attack animations_attack up_1.png │ │ │ │ ├── rogue like attack animations_attack up_2.png │ │ │ │ ├── rogue like attack animations_attack up_3.png │ │ │ │ ├── rogue like attack.png │ │ │ │ ├── rogue like attack_Animation 1_0.png │ │ │ │ ├── rogue like attack_Animation 1_1.png │ │ │ │ ├── rogue like attack_Animation 1_2.png │ │ │ │ ├── rogue like attack_Animation 1_3.png │ │ │ │ ├── rogue like attack_Animation 1_4.png │ │ │ │ ├── rogue like attack_Animation 1_5.png │ │ │ │ ├── rogue like attack_Animation 1_6.png │ │ │ │ ├── rogue like attack_Animation 1_7.png │ │ │ │ ├── rogue like attack_Animation 1_8.png │ │ │ │ ├── rogue like attack_Animation 1_9.png │ │ │ │ ├── rogue like idle.png │ │ │ │ ├── rogue like idle_Animation 1_0.png │ │ │ │ ├── rogue like idle_Animation 1_1.png │ │ │ │ ├── rogue like idle_Animation 1_2.png │ │ │ │ ├── rogue like run up_Animation 1_0.png │ │ │ │ ├── rogue like run up_Animation 1_1.png │ │ │ │ ├── rogue like run up_Animation 1_2.png │ │ │ │ ├── rogue like run up_Animation 1_3.png │ │ │ │ ├── rogue like run.png │ │ │ │ ├── rogue like run_Animation 1_0.png │ │ │ │ ├── rogue like run_Animation 1_1.png │ │ │ │ ├── rogue like run_Animation 1_2.png │ │ │ │ ├── rogue like run_Animation 1_3.png │ │ │ │ ├── rogue like run_Animation 1_4.png │ │ │ │ ├── rogue like run_Animation 1_5.png │ │ │ │ ├── roguelike run down_Animation 1_0.png │ │ │ │ ├── roguelike run down_Animation 1_1.png │ │ │ │ ├── roguelike run down_Animation 1_2.png │ │ │ │ └── roguelike run down_Animation 1_3.png │ │ ├── wizardPlayer.png │ │ └── workinprogress │ │ │ ├── playerformatted.pdn │ │ │ └── playerformatted.png │ │ ├── font │ │ ├── GravityBold8.ttf │ │ ├── Stackedpixel.ttf │ │ ├── ZeldaFont.png │ │ ├── cbbpv-crxg4.png │ │ ├── cbiak-org1k.png │ │ ├── font.png │ │ └── galaxyfont.png │ │ ├── item │ │ ├── The Humble Item Pack.png │ │ └── items.png │ │ ├── material │ │ ├── treepacknewest.png │ │ └── trees.png │ │ ├── new │ │ ├── Adventurer-1.5.zip │ │ ├── Adventurer-Bow.zip │ │ ├── Adventurer-Hand-Combat.zip │ │ └── Roguelike Dungeon - Asset Bundle.rar │ │ ├── tile │ │ ├── 0x72_DungeonTilesetII_v1.2.png │ │ ├── Dungeon1.png │ │ ├── OutdoorsTileset.png │ │ ├── TilesetGraveyard.png │ │ ├── dungeon_tiles_formatted_v2.png │ │ ├── interactivetiles.png │ │ ├── overworld.png │ │ ├── overworldOP.png │ │ ├── tempmappng.png │ │ ├── terrain_atlas.png │ │ ├── tilemap.tmx │ │ └── tilemap.xml │ │ └── ui │ │ ├── #1 - Transparent Icons.png │ │ ├── Shikashi's Fantasy Icons Pack │ │ ├── #2 - Transparent & Drop Shadow.png │ │ ├── Background 10.png │ │ ├── Background 1a.png │ │ ├── Background 1b.png │ │ ├── Background 2.png │ │ ├── Background 2a.png │ │ ├── Background 2b.png │ │ ├── Background 2c.png │ │ ├── Background 3a.png │ │ ├── Background 3b.png │ │ ├── Background 4.png │ │ ├── Background 5.png │ │ ├── Background 6.png │ │ ├── Background 7.png │ │ ├── Background 8.png │ │ ├── Background 9.png │ │ └── Shikashi's Fantasy Icons Pack.txt │ │ ├── buttons.png │ │ ├── fillbars.png │ │ ├── icons.png │ │ ├── slots.png │ │ ├── ui.png │ │ └── ui_big_pieces.png │ └── test │ └── java │ └── com │ └── zerulus │ └── game │ └── AppTest.java └── pic ├── demo_0.png └── demo_1.png /.vscode/ipch/977087a4c1e9bf46/RUN.ipch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/.vscode/ipch/977087a4c1e9bf46/RUN.ipch -------------------------------------------------------------------------------- /.vscode/ipch/977087a4c1e9bf46/mmap_address.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/.vscode/ipch/977087a4c1e9bf46/mmap_address.bin -------------------------------------------------------------------------------- /.vscode/ipch/f27903df2b35b70b/BUILD.ipch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/.vscode/ipch/f27903df2b35b70b/BUILD.ipch -------------------------------------------------------------------------------- /.vscode/ipch/f27903df2b35b70b/mmap_address.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/.vscode/ipch/f27903df2b35b70b/mmap_address.bin -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "type": "java", 5 | "name": "CodeLens (Launch) - GameLauncher", 6 | "request": "launch", 7 | "mainClass": "com.zerulus.game.GameLauncher", 8 | "projectName": "game-decay" 9 | } 10 | ] 11 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic" 3 | } -------------------------------------------------------------------------------- /Decay.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "java.configuration.updateBuildConfiguration": "automatic", 9 | "FSharp.fsacRuntime": "netcore" 10 | } 11 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Daniel Castro 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A Simple Java 2D Game 2 | === 3 | Youtube channel: https://www.youtube.com/user/TheZeroDoctor 4 | --- 5 | Compiled and Ran with Maven: 6 | 7 | Download Maven: https://maven.apache.org/download.cgi 8 | Tutorial on installation: https://www.youtube.com/watch?v=6AVC3X88z6E 9 | 10 | Compile with: mvn compile 11 | Run with: mvn exec:java 12 | 13 | --- 14 | ## Demo So Far ## 15 | 16 | ![alt text](https://github.com/ZeroDoctor/yt-java-game/blob/master/pic/demo_0.png "Random Generated World") 17 | 18 | ![alt text](https://github.com/ZeroDoctor/yt-java-game/blob/master/pic/demo_1.png "Static Dungeon") 19 | -------------------------------------------------------------------------------- /game-decay/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 4 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | 15 | [*.yml] 16 | indent_size = 2 17 | 18 | [*.sh] 19 | end_of_line = lf 20 | -------------------------------------------------------------------------------- /game-decay/.gitattributes: -------------------------------------------------------------------------------- 1 | # When shell scripts end in CRLF, bash gives a cryptic error message 2 | *.sh text eol=lf 3 | -------------------------------------------------------------------------------- /game-decay/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # Standard Maven .gitignore 3 | # 4 | target/ 5 | pom.xml.tag 6 | pom.xml.releaseBackup 7 | pom.xml.versionsBackup 8 | pom.xml.next 9 | release.properties 10 | dependency-reduced-pom.xml 11 | buildNumber.properties 12 | .mvn/timing.properties 13 | 14 | # 15 | # IntelliJ 16 | # 17 | *.iml 18 | .idea/* 19 | !.idea/runConfigurations/ 20 | 21 | # 22 | # Visual Studio Code 23 | # 24 | .settings/ 25 | .classpath 26 | .project 27 | .vscode/ 28 | -------------------------------------------------------------------------------- /game-decay/.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: oraclejdk8 3 | after_success: 4 | - mvn coveralls:report 5 | -------------------------------------------------------------------------------- /game-decay/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.zerulus.game 5 | game-decay 6 | Decay 7 | 8 | 1.8 9 | 1.8 10 | UTF-8 11 | 12 | 13 | 14 | junit 15 | junit 16 | 4.13.1 17 | test 18 | 19 | 20 | 21 | 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-checkstyle-plugin 26 | 3.0.0 27 | 28 | 29 | com.puppycrawl.tools 30 | checkstyle 31 | 8.29 32 | 33 | 34 | com.github.ngeor 35 | checkstyle-rules 36 | 1.1.0 37 | 38 | 39 | 40 | com/github/ngeor/checkstyle.xml 41 | true 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.apache.maven.plugins 49 | maven-checkstyle-plugin 50 | 51 | 52 | 56 | 57 | org.jacoco 58 | jacoco-maven-plugin 59 | 0.8.1 60 | 61 | 62 | 63 | org.codehaus.mojo 64 | exec-maven-plugin 65 | 1.2.1 66 | 67 | com.zerulus.game.GameLauncher 68 | 69 | 70 | 71 | 72 | org.apache.maven.plugins 73 | maven-jar-plugin 74 | 3.0.2 75 | 76 | 77 | 78 | com.zerulus.game.GameLauncher 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | org.apache.maven.plugins 92 | maven-javadoc-plugin 93 | 3.0.0 94 | 95 | 96 | org.apache.maven.plugins 97 | maven-checkstyle-plugin 98 | 99 | com/github/ngeor/checkstyle.xml 100 | true 101 | 102 | 103 | 104 | 105 | 106 | 107 | 112 | 113 | jacoco 114 | 115 | 116 | env.TRAVIS 117 | 118 | 119 | 120 | 121 | 122 | org.jacoco 123 | jacoco-maven-plugin 124 | 125 | 126 | prepare-agent 127 | validate 128 | 129 | prepare-agent 130 | 131 | 132 | 133 | report 134 | test 135 | 136 | report 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 150 | 151 | travis 152 | 153 | 154 | env.TRAVIS 155 | 156 | 157 | 158 | 159 | 160 | org.apache.maven.plugins 161 | maven-checkstyle-plugin 162 | 163 | 164 | checkstyle 165 | test 166 | 167 | check 168 | 169 | 170 | 171 | 172 | 173 | org.eluder.coveralls 174 | coveralls-maven-plugin 175 | 4.3.0 176 | 177 | 178 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/GameLauncher.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game; 2 | 3 | public class GameLauncher { 4 | 5 | public GameLauncher() { 6 | new Window(); 7 | } 8 | 9 | public static void main(String[] args) { 10 | new GameLauncher(); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/GamePanel.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game; 2 | 3 | import java.awt.Color; 4 | import java.awt.Dimension; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.RenderingHints; 8 | import java.awt.image.BufferStrategy; 9 | import java.awt.image.BufferedImage; 10 | 11 | import javax.swing.JPanel; 12 | 13 | import com.zerulus.game.states.GameStateManager; 14 | import com.zerulus.game.util.MouseHandler; 15 | import com.zerulus.game.util.KeyHandler; 16 | 17 | 18 | public class GamePanel extends JPanel implements Runnable { 19 | 20 | public static final long serialVersionUID = 1L; 21 | 22 | public static int width; 23 | public static int height; 24 | public static int oldFrameCount; 25 | public static int oldTickCount; 26 | public static int tickCount; 27 | 28 | private Thread thread; 29 | private boolean running = false; 30 | 31 | private BufferStrategy bs; 32 | private BufferedImage img; 33 | private Graphics2D g; 34 | 35 | private MouseHandler mouse; 36 | private KeyHandler key; 37 | 38 | private GameStateManager gsm; 39 | 40 | public GamePanel(BufferStrategy bs, int width, int height) { 41 | GamePanel.width = width; 42 | GamePanel.height = height; 43 | this.bs = bs; 44 | setPreferredSize(new Dimension(width, height)); 45 | setFocusable(true); 46 | requestFocus(); 47 | } 48 | 49 | public void addNotify() { 50 | super.addNotify(); 51 | 52 | if (thread == null) { 53 | thread = new Thread(this, "GameThread"); 54 | thread.start(); 55 | } 56 | } 57 | 58 | public void initGraphics() { 59 | img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 60 | g = (Graphics2D) img.getGraphics(); 61 | g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 62 | } 63 | 64 | public void init() { 65 | running = true; 66 | 67 | initGraphics(); 68 | 69 | mouse = new MouseHandler(this); 70 | key = new KeyHandler(this); 71 | 72 | gsm = new GameStateManager(g); 73 | } 74 | 75 | public void run() { 76 | init(); 77 | 78 | final double GAME_HERTZ = 64.0; 79 | final double TBU = 1000000000 / GAME_HERTZ; // Time Before Update 80 | 81 | final int MUBR = 3; // Must Update before render 82 | 83 | double lastUpdateTime = System.nanoTime(); 84 | double lastRenderTime; 85 | 86 | final double TARGET_FPS = 1000; 87 | final double TTBR = 1000000000 / TARGET_FPS; // Total time before render 88 | 89 | int frameCount = 0; 90 | int lastSecondTime = (int) (lastUpdateTime / 1000000000); 91 | oldFrameCount = 0; 92 | 93 | tickCount = 0; 94 | oldTickCount = 0; 95 | 96 | while (running) { 97 | 98 | double now = System.nanoTime(); 99 | int updateCount = 0; 100 | while (((now - lastUpdateTime) > TBU) && (updateCount < MUBR)) { 101 | update(now); 102 | input(mouse, key); 103 | lastUpdateTime += TBU; 104 | updateCount++; 105 | tickCount++; 106 | // (^^^^) We use this varible for the soul purpose of displaying it 107 | } 108 | 109 | if ((now - lastUpdateTime) > TBU) { 110 | lastUpdateTime = now - TBU; 111 | } 112 | 113 | input(mouse, key); 114 | render(); 115 | draw(); 116 | lastRenderTime = now; 117 | frameCount++; 118 | 119 | int thisSecond = (int) (lastUpdateTime / 1000000000); 120 | if (thisSecond > lastSecondTime) { 121 | if (frameCount != oldFrameCount) { 122 | System.out.println("NEW SECOND " + thisSecond + " " + frameCount); 123 | oldFrameCount = frameCount; 124 | } 125 | 126 | if (tickCount != oldTickCount) { 127 | System.out.println("NEW SECOND (T) " + thisSecond + " " + tickCount); 128 | oldTickCount = tickCount; 129 | } 130 | tickCount = 0; 131 | frameCount = 0; 132 | lastSecondTime = thisSecond; 133 | } 134 | 135 | while (now - lastRenderTime < TTBR && now - lastUpdateTime < TBU) { 136 | Thread.yield(); 137 | 138 | try { 139 | Thread.sleep(1); 140 | } catch (Exception e) { 141 | System.out.println("ERROR: yielding thread"); 142 | } 143 | 144 | now = System.nanoTime(); 145 | } 146 | 147 | } 148 | } 149 | 150 | public void update(double time) { 151 | gsm.update(time); 152 | } 153 | 154 | public void input(MouseHandler mouse, KeyHandler key) { 155 | gsm.input(mouse, key); 156 | } 157 | 158 | public void render() { 159 | if (g != null) { 160 | g.setColor(new Color(33, 30, 39)); 161 | g.fillRect(0, 0, width, height); 162 | gsm.render(g); 163 | } 164 | } 165 | 166 | public void draw() { 167 | do { 168 | Graphics g2 = (Graphics) bs.getDrawGraphics(); 169 | g2.drawImage(img, 3, 26, width + 10, height + 10, null); // true 8, 31 170 | g2.dispose(); 171 | bs.show(); 172 | } while(bs.contentsLost()); 173 | 174 | } 175 | 176 | } 177 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/Window.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game; 2 | 3 | import java.awt.image.BufferStrategy; 4 | 5 | import javax.swing.JFrame; 6 | 7 | public class Window extends JFrame { 8 | public static final long serialVersionUID = 1L; 9 | 10 | private BufferStrategy bs; 11 | private GamePanel gp; 12 | 13 | public Window() { 14 | setTitle("Decay"); 15 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 16 | setIgnoreRepaint(true); 17 | pack(); 18 | setLocationRelativeTo(null); 19 | setResizable(false); 20 | setVisible(true); 21 | } 22 | 23 | public void addNotify() { 24 | super.addNotify(); 25 | 26 | createBufferStrategy(2); 27 | bs = getBufferStrategy(); 28 | 29 | gp = new GamePanel(bs, 1280, 720); 30 | //add(gp); 31 | setContentPane(gp); 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/entity/Enemy.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.entity; 2 | 3 | import com.zerulus.game.graphics.SpriteSheet; 4 | import com.zerulus.game.util.Camera; 5 | import com.zerulus.game.math.AABB; 6 | import com.zerulus.game.math.Vector2f; 7 | 8 | import java.util.ArrayList; 9 | import java.awt.Graphics2D; 10 | import java.awt.Color; 11 | 12 | public abstract class Enemy extends Entity { 13 | 14 | protected AABB sense; 15 | protected int r_sense; 16 | 17 | protected AABB attackrange; 18 | protected int r_attackrange; 19 | 20 | private Camera cam; 21 | 22 | protected int xOffset; 23 | protected int yOffset; 24 | 25 | protected ArrayList collisions; 26 | 27 | public Enemy(Camera cam, SpriteSheet sprite, Vector2f origin, int size) { 28 | super(sprite, origin, size); 29 | this.cam = cam; 30 | 31 | bounds.setWidth(size / 2); 32 | bounds.setHeight(size / 2 - yOffset); 33 | bounds.setXOffset(size / 2 - xOffset); 34 | bounds.setYOffset(size / 2 + yOffset); 35 | 36 | sense = new AABB(new Vector2f(origin.x + size / 2 - r_sense / 2, origin.y + size / 2 - r_sense / 2), r_sense); 37 | attackrange = new AABB(new Vector2f(origin.x + bounds.getXOffset() + bounds.getWidth() / 2 - r_attackrange / 2 , origin.y + bounds.getYOffset() + bounds.getHeight() / 2 - r_attackrange / 2 ), r_attackrange); 38 | } 39 | 40 | public void chase(Player player) { 41 | AABB playerBounds = player.getBounds(); 42 | if (sense.colCircleBox(playerBounds) && !attackrange.colCircleBox(playerBounds)) { 43 | if (pos.y > player.pos.y + 1) { 44 | up = true; 45 | } else { 46 | up = false; 47 | } 48 | if (pos.y < player.pos.y - 1) { 49 | down = true; 50 | } else { 51 | down = false; 52 | } 53 | 54 | if (pos.x > player.pos.x + 1) { 55 | left = true; 56 | } else { 57 | left = false; 58 | } 59 | if (pos.x < player.pos.x - 1) { 60 | right = true; 61 | } else { 62 | right = false; 63 | } 64 | } else { 65 | up = false; 66 | down = false; 67 | left = false; 68 | right = false; 69 | } 70 | } 71 | 72 | public void update(Player player, double time) { 73 | if(cam.getBounds().collides(this.bounds)) { 74 | super.update(time); 75 | chase(player); 76 | move(); 77 | 78 | if(teleported) { 79 | teleported = false; 80 | 81 | bounds.setWidth(size / 2); 82 | bounds.setHeight(size / 2 - yOffset); 83 | bounds.setXOffset(size / 2 - xOffset); 84 | bounds.setYOffset(size / 2 + yOffset); 85 | 86 | hitBounds = new AABB(pos, size, size); 87 | hitBounds.setXOffset(size / 2); 88 | 89 | sense = new AABB(new Vector2f(pos.x + size / 2 - r_sense / 2, pos.y + size / 2 - r_sense / 2), r_sense); 90 | attackrange = new AABB(new Vector2f(pos.x + bounds.getXOffset() + bounds.getWidth() / 2 - r_attackrange / 2 , pos.y + bounds.getYOffset() + bounds.getHeight() / 2 - r_attackrange / 2 ), r_attackrange); 91 | } 92 | 93 | if(attackrange.colCircleBox(player.getBounds()) && !isInvincible) { 94 | attack = true; 95 | player.setHealth(player.getHealth() - damage, 5f * getDirection(), currentDirection == UP || currentDirection == DOWN); 96 | } else { 97 | attack = false; 98 | } 99 | 100 | if (!fallen) { 101 | if (!tc.collisionTile(dx, 0)) { 102 | sense.getPos().x += dx; 103 | attackrange.getPos().x += dx; 104 | pos.x += dx; 105 | } 106 | if (!tc.collisionTile(0, dy)) { 107 | sense.getPos().y += dy; 108 | attackrange.getPos().y += dy; 109 | pos.y += dy; 110 | } 111 | } else { 112 | if(ani.hasPlayedOnce()) { 113 | die = true; 114 | } 115 | } 116 | } 117 | } 118 | 119 | @Override 120 | public void render(Graphics2D g) { 121 | if(cam.getBounds().collides(this.bounds)) { 122 | 123 | //if(isInvincible) 124 | if(useRight && left) { 125 | g.drawImage(ani.getImage().image, (int) (pos.getWorldVar().x) + size, (int) (pos.getWorldVar().y), -size, size, null); 126 | } else { 127 | g.drawImage(ani.getImage().image, (int) (pos.getWorldVar().x), (int) (pos.getWorldVar().y), size, size, null); 128 | } 129 | 130 | 131 | // Health Bar UI 132 | g.setColor(Color.red); 133 | g.fillRect((int) (pos.getWorldVar().x + bounds.getXOffset()), (int) (pos.getWorldVar().y - 5), 24, 5); 134 | 135 | g.setColor(Color.green); 136 | g.fillRect((int) (pos.getWorldVar().x + bounds.getXOffset()), (int) (pos.getWorldVar().y - 5), (int) (24 * healthpercent), 5); 137 | 138 | } 139 | } 140 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/entity/GameObject.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.entity; 2 | 3 | import com.zerulus.game.graphics.SpriteSheet; 4 | import com.zerulus.game.graphics.Sprite; 5 | import com.zerulus.game.math.AABB; 6 | import com.zerulus.game.math.Vector2f; 7 | import com.zerulus.game.util.TileCollision; 8 | 9 | import java.awt.Graphics2D; 10 | 11 | public abstract class GameObject { 12 | 13 | protected SpriteSheet sprite; 14 | protected Sprite image; 15 | protected AABB bounds; 16 | protected Vector2f pos; 17 | protected int size; 18 | protected int spriteX; 19 | protected int spriteY; 20 | 21 | // used for moving objects like boxes and such 22 | protected float dx; 23 | protected float dy; 24 | 25 | protected float maxSpeed = 4f; 26 | protected float acc = 2f; 27 | protected float deacc = 0.3f; 28 | protected float force = 25f; 29 | 30 | protected boolean teleported = false; 31 | protected TileCollision tc; 32 | protected String name = ""; 33 | 34 | public GameObject(SpriteSheet sprite, Vector2f origin, int spriteX, int spriteY, int size) { 35 | this(origin, size); 36 | this.sprite = sprite; 37 | } 38 | 39 | public GameObject(Sprite image, Vector2f origin, int size) { 40 | this(origin, size); 41 | this.image = image; 42 | } 43 | 44 | private GameObject(Vector2f origin, int size) { 45 | this.bounds = new AABB(origin, size, size); 46 | this.pos = origin; 47 | this.size = size; 48 | } 49 | 50 | public void setPos(Vector2f pos) { 51 | this.pos = pos; 52 | this.bounds = new AABB(pos, size, size); 53 | teleported = true; 54 | } 55 | 56 | public Sprite getImage() { return image; } 57 | 58 | public void setName(String name) { this.name = name; } 59 | public void setSprite(SpriteSheet sprite) { this.sprite = sprite; } 60 | public void setSize(int i) { size = i; } 61 | public void setMaxSpeed(float f) { maxSpeed = f; } 62 | public void setAcc(float f) { acc = f; } 63 | public void setDeacc(float f) { deacc = f; } 64 | 65 | public float getDeacc() { return deacc; } 66 | public float getAcc() { return acc; } 67 | public float getMaxSpeed() { return maxSpeed; } 68 | public float getDx() { return dx; } 69 | public float getDy() { return dy; } 70 | public AABB getBounds() { return bounds; } 71 | public Vector2f getPos() { return pos; } 72 | public int getSize() { return size; } 73 | 74 | public void addForce(float a, boolean vertical) { 75 | if(!vertical) { 76 | dx -= a; 77 | } else { 78 | dy -= a; 79 | } 80 | } 81 | 82 | public void update() { 83 | 84 | } 85 | 86 | public void render(Graphics2D g) { 87 | g.drawImage(image.image, (int) (pos.getWorldVar().x), (int) (pos.getWorldVar().y), size, size, null); 88 | } 89 | 90 | public String toString() { 91 | return "$" + name; 92 | } 93 | 94 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/entity/Gathers.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.entity; 2 | 3 | import com.zerulus.game.graphics.SpriteSheet; 4 | import com.zerulus.game.math.Vector2f; 5 | 6 | import java.awt.Graphics2D; 7 | 8 | public class Gathers extends Entity { 9 | 10 | private int material; 11 | 12 | public Gathers(SpriteSheet sprite, Vector2f origin, int size, int material) { 13 | super(sprite, origin, size); 14 | this.material = material; 15 | } 16 | 17 | public int getMaterial() { return material; } 18 | 19 | public void update() { 20 | 21 | } 22 | 23 | public void render(Graphics2D g) { 24 | 25 | } 26 | 27 | 28 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/entity/Player.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.entity; 2 | 3 | 4 | import com.zerulus.game.GamePanel; 5 | 6 | import com.zerulus.game.graphics.SpriteSheet; 7 | import com.zerulus.game.graphics.Sprite; 8 | 9 | import com.zerulus.game.util.KeyHandler; 10 | import com.zerulus.game.util.MouseHandler; 11 | import com.zerulus.game.util.Camera; 12 | 13 | import com.zerulus.game.math.Vector2f; 14 | import com.zerulus.game.states.PlayState; 15 | 16 | import com.zerulus.game.tiles.TileManager; 17 | import com.zerulus.game.tiles.blocks.NormBlock; 18 | 19 | import java.util.ArrayList; 20 | import java.awt.Color; 21 | import java.awt.Graphics2D; 22 | 23 | public class Player extends Entity { 24 | 25 | private Camera cam; 26 | private ArrayList enemy; 27 | private ArrayList go; 28 | private TileManager tm; 29 | 30 | public Player(Camera cam, SpriteSheet sprite, Vector2f origin, int size, TileManager tm) { 31 | super(sprite, origin, size); 32 | this.cam = cam; 33 | this.tm = tm; 34 | 35 | bounds.setWidth(32); 36 | bounds.setHeight(20); 37 | bounds.setXOffset(16); 38 | bounds.setYOffset(40); 39 | 40 | hitBounds.setWidth(42); 41 | hitBounds.setHeight(42); 42 | 43 | ani.setNumFrames(4, UP); 44 | ani.setNumFrames(4, DOWN); 45 | ani.setNumFrames(4, ATTACK + RIGHT); 46 | ani.setNumFrames(4, ATTACK + LEFT); 47 | ani.setNumFrames(4, ATTACK + UP); 48 | ani.setNumFrames(4, ATTACK + DOWN); 49 | 50 | enemy = new ArrayList(); 51 | go = new ArrayList(); 52 | 53 | for(int i = 0; i < sprite.getSpriteArray2().length; i++) { 54 | for(int j = 0; j < sprite.getSpriteArray2()[i].length; j++) { 55 | sprite.getSpriteArray2()[i][j].setEffect(Sprite.effect.NEGATIVE); 56 | sprite.getSpriteArray2()[i][j].saveColors(); 57 | } 58 | } 59 | 60 | hasIdle = false; 61 | health = 500; 62 | maxHealth = 500; 63 | name = "player"; 64 | } 65 | 66 | public void setTargetEnemy(Enemy enemy) { 67 | this.enemy.add(enemy); 68 | } 69 | 70 | public void setTargetGameObject(GameObject go) { 71 | if(!this.go.contains(go)) 72 | this.go.add(go); 73 | } 74 | 75 | private void resetPosition() { 76 | System.out.println("Reseting Player... "); 77 | pos.x = GamePanel.width / 2 - 32; 78 | PlayState.map.x = 0; 79 | cam.getPos().x = 0; 80 | 81 | pos.y = GamePanel.height /2 - 32; 82 | PlayState.map.y = 0; 83 | cam.getPos().y = 0; 84 | 85 | setAnimation(RIGHT, sprite.getSpriteArray(RIGHT), 10); 86 | } 87 | 88 | public void update(double time) { 89 | super.update(time); 90 | 91 | attacking = isAttacking(time); 92 | for(int i = 0; i < enemy.size(); i++) { 93 | if(attacking) { 94 | enemy.get(i).setHealth(enemy.get(i).getHealth() - damage, force * getDirection(), currentDirection == UP || currentDirection == DOWN); 95 | enemy.remove(i); 96 | } 97 | } 98 | 99 | if(!fallen) { 100 | move(); 101 | if(!tc.collisionTile(dx, 0) && !bounds.collides(dx, 0, go)) { 102 | //PlayState.map.x += dx; 103 | pos.x += dx; 104 | xCol = false; 105 | } else { 106 | xCol = true; 107 | } 108 | if(!tc.collisionTile(0, dy) && !bounds.collides(0, dy, go)) { 109 | //PlayState.map.y += dy; 110 | pos.y += dy; 111 | yCol = false; 112 | } else { 113 | yCol = true; 114 | } 115 | 116 | tc.normalTile(dx, 0); 117 | tc.normalTile(0, dy); 118 | 119 | } else { 120 | xCol = true; 121 | yCol = true; 122 | if(ani.hasPlayedOnce()) { 123 | resetPosition(); 124 | dx = 0; 125 | dy = 0; 126 | fallen = false; 127 | } 128 | } 129 | 130 | NormBlock[] block = tm.getNormalTile(tc.getTile()); 131 | for(int i = 0; i < block.length; i++) { 132 | if(block[i] != null) 133 | block[i].getImage().restoreDefault(); 134 | } 135 | } 136 | 137 | @Override 138 | public void render(Graphics2D g) { 139 | g.setColor(Color.green); 140 | g.drawRect((int) (pos.getWorldVar().x + bounds.getXOffset()), (int) (pos.getWorldVar().y + bounds.getYOffset()), (int) bounds.getWidth(), (int) bounds.getHeight()); 141 | 142 | if(attack) { 143 | g.setColor(Color.red); 144 | g.drawRect((int) (hitBounds.getPos().getWorldVar().x + hitBounds.getXOffset()), (int) (hitBounds.getPos().getWorldVar().y + hitBounds.getYOffset()), (int) hitBounds.getWidth(), (int) hitBounds.getHeight()); 145 | } 146 | 147 | if(isInvincible) { 148 | if(GamePanel.tickCount % 30 >= 15) { 149 | ani.getImage().setEffect(Sprite.effect.REDISH); 150 | } else { 151 | ani.getImage().restoreColors(); 152 | } 153 | } else { 154 | ani.getImage().restoreColors(); 155 | } 156 | 157 | if(useRight && left) { 158 | g.drawImage(ani.getImage().image, (int) (pos.getWorldVar().x) + size, (int) (pos.getWorldVar().y), -size, size, null); 159 | } else { 160 | g.drawImage(ani.getImage().image, (int) (pos.getWorldVar().x), (int) (pos.getWorldVar().y), size, size, null); 161 | } 162 | } 163 | 164 | public void input(MouseHandler mouse, KeyHandler key) { 165 | 166 | if(!fallen) { 167 | if(key.up.down) { 168 | up = true; 169 | } else { 170 | up = false; 171 | } 172 | if(key.down.down) { 173 | down = true; 174 | } else { 175 | down = false; 176 | } 177 | if(key.left.down) { 178 | left = true; 179 | } else { 180 | left = false; 181 | } 182 | if(key.right.down) { 183 | right = true; 184 | } else { 185 | right = false; 186 | } 187 | 188 | if(key.attack.down && canAttack) { 189 | attack = true; 190 | attacktime = System.nanoTime(); 191 | } else { 192 | if(!attacking) { 193 | attack = false; 194 | } 195 | } 196 | 197 | if(key.shift.down) { 198 | maxSpeed = 8; 199 | cam.setMaxSpeed(7); 200 | } else { 201 | maxSpeed = 4; 202 | cam.setMaxSpeed(4); 203 | } 204 | 205 | if(up && down) { 206 | up = false; 207 | down = false; 208 | } 209 | 210 | if(right && left) { 211 | right = false; 212 | left = false; 213 | } 214 | } else { 215 | up = false; 216 | down = false; 217 | right = false; 218 | left = false; 219 | } 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/entity/enemy/TinyMon.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.entity.enemy; 2 | 3 | import com.zerulus.game.entity.Enemy; 4 | import com.zerulus.game.graphics.SpriteSheet; 5 | import com.zerulus.game.util.Camera; 6 | import com.zerulus.game.math.Vector2f; 7 | 8 | public class TinyMon extends Enemy { 9 | 10 | public TinyMon(Camera cam, SpriteSheet sprite, Vector2f origin, int size) { 11 | super(cam, sprite, origin, size); 12 | xOffset = size / 4; 13 | yOffset = size / 4; 14 | 15 | damage = 10; 16 | acc = 1f; 17 | deacc = 2f; 18 | maxSpeed = 2f; 19 | r_sense = 350; 20 | r_attackrange = 32; 21 | 22 | ATTACK = 0; 23 | IDLE = 0; 24 | FALLEN = 1; 25 | UP = 1; 26 | DOWN = 1; 27 | LEFT = 1; 28 | RIGHT = 1; 29 | 30 | hasIdle = true; 31 | useRight = true; 32 | 33 | ani.setNumFrames(3, 0); 34 | ani.setNumFrames(5, 1); 35 | 36 | currentAnimation = IDLE; 37 | right = true; 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/entity/material/Material.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.entity.material; 2 | 3 | import com.zerulus.game.graphics.Sprite; 4 | import com.zerulus.game.math.Vector2f; 5 | import com.zerulus.game.entity.GameObject; 6 | 7 | import java.awt.Graphics2D; 8 | 9 | public class Material extends GameObject { 10 | 11 | protected int maxHealth = 100; 12 | protected int health = 100; 13 | protected int damage = 10; 14 | protected int material; 15 | 16 | public Material(Sprite image, Vector2f origin, int size, int material) { 17 | super(image, origin, size); 18 | this.material = material; 19 | 20 | bounds.setXOffset(16); 21 | bounds.setYOffset(48); 22 | bounds.setWidth(32); 23 | bounds.setHeight(16); 24 | 25 | image.setEffect(Sprite.effect.DECAY); 26 | } 27 | 28 | public void update() { 29 | 30 | } 31 | 32 | public void render(Graphics2D g) { 33 | g.drawImage(image.image, (int) (pos.getWorldVar().x), (int) (pos.getWorldVar().y), size, size, null); 34 | } 35 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/entity/material/MaterialManager.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.entity.material; 2 | 3 | import java.util.ArrayList; 4 | 5 | import com.zerulus.game.GamePanel; 6 | import com.zerulus.game.graphics.Sprite; 7 | import com.zerulus.game.math.Vector2f; 8 | import com.zerulus.game.util.GameObjectKey; 9 | 10 | public class MaterialManager { 11 | 12 | public ArrayList list; 13 | public static enum TYPE { 14 | TREE(0), STONE(1), IRON(2), WHEAT(3); 15 | 16 | private final int value; 17 | 18 | TYPE(final int newValue) { 19 | value = newValue; 20 | } 21 | 22 | public int getValue() { return value; } 23 | }; 24 | 25 | private TemplateMaterial[] tempMaterial; 26 | 27 | private int tileSize; 28 | private int chuckSize; 29 | private Vector2f playerStart = new Vector2f(0 + (GamePanel.width / 2) - 32, 0 + (GamePanel.height / 2) - 32); 30 | 31 | public MaterialManager(int tileSize, int chuckSize) { 32 | this.tileSize = tileSize; 33 | this.chuckSize = chuckSize; 34 | list = new ArrayList(); 35 | tempMaterial = new TemplateMaterial[4]; 36 | 37 | } 38 | 39 | public void setMaterial(TYPE material, Sprite sprite, int size) { 40 | if(tempMaterial[material.getValue()] == null) { 41 | tempMaterial[material.getValue()] = new TemplateMaterial(size); 42 | } 43 | 44 | tempMaterial[material.getValue()].images.add(sprite); 45 | } 46 | 47 | public int add(TYPE material, int position) { 48 | 49 | int size = Math.max(tileSize, tempMaterial[material.getValue()].size); 50 | int length = (tempMaterial[material.getValue()].images.size() / 10) + 1; // 10 images in trees SpriteSheet, thus change later 51 | int index = (int) (Math.random() * (10 * length)) % (tempMaterial[material.getValue()].images.size()); 52 | 53 | Vector2f pos = new Vector2f((position % chuckSize) * size, (position / chuckSize) * size); 54 | 55 | Material mat = new Material(tempMaterial[material.getValue()].images.get(index).getNewSubimage(), pos, size, material.getValue()); 56 | float distance = mat.getBounds().distance(playerStart); 57 | list.add(new GameObjectKey(distance, mat)); 58 | 59 | return material.getValue(); 60 | } 61 | } 62 | 63 | class TemplateMaterial { 64 | 65 | public int size; 66 | public ArrayList images; 67 | 68 | public TemplateMaterial(int size) { 69 | this.size = size; 70 | this.images = new ArrayList(); 71 | } 72 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/graphics/Animation.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.graphics; 2 | 3 | import com.zerulus.game.graphics.Sprite; 4 | 5 | public class Animation { 6 | 7 | private Sprite[] frames; 8 | private int[] states; 9 | private int currentFrame; 10 | private int numFrames; 11 | 12 | private int count; 13 | private int delay; 14 | 15 | private int timesPlayed; 16 | 17 | public Animation(Sprite[] frames) { 18 | setFrames(0, frames); 19 | timesPlayed = 0; 20 | states = new int[10]; 21 | } 22 | 23 | public Animation() { 24 | timesPlayed = 0; 25 | states = new int[10]; 26 | } 27 | 28 | public void setFrames(int state, Sprite[] frames) { 29 | this.frames = frames; 30 | currentFrame = 0; 31 | count = 0; 32 | timesPlayed = 0; 33 | delay = 2; 34 | if(states[state] == 0) { 35 | numFrames = frames.length; 36 | } else { 37 | numFrames = states[state]; 38 | } 39 | } 40 | 41 | public void setDelay(int i) { delay = i; } 42 | public void setFrame(int i) { currentFrame = i; } 43 | public void setNumFrames(int i, int state) { states[state] = i; } 44 | 45 | public void update() { 46 | if(delay == -1) return; 47 | 48 | count++; 49 | 50 | if(count == delay) { 51 | currentFrame++; 52 | count = 0; 53 | } 54 | if(currentFrame == numFrames) { 55 | currentFrame = 0; 56 | timesPlayed++; 57 | } 58 | } 59 | 60 | public int getDelay() { return delay; } 61 | public int getFrame() { return currentFrame; } 62 | public int getCount() { return count; } 63 | public Sprite getImage() { return frames[currentFrame]; } 64 | public boolean hasPlayedOnce() { return timesPlayed > 0; } 65 | public boolean hasPlayed(int i) { return timesPlayed == i; } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/graphics/Font.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.graphics; 2 | 3 | import java.awt.image.BufferedImage; 4 | 5 | import javax.imageio.ImageIO; 6 | 7 | public class Font { 8 | 9 | private BufferedImage FONTSHEET = null; 10 | private BufferedImage[][] spriteArray; 11 | private final int TILE_SIZE = 32; 12 | public int w; 13 | public int h; 14 | private int wLetter; 15 | private int hLetter; 16 | 17 | public Font(String file) { 18 | w = TILE_SIZE; 19 | h = TILE_SIZE; 20 | 21 | System.out.println("Loading: " + file + "..."); 22 | FONTSHEET = loadFont(file); 23 | 24 | wLetter = FONTSHEET.getWidth() / w; 25 | hLetter = FONTSHEET.getHeight() / h; 26 | loadFontArray(); 27 | } 28 | 29 | public Font(String file, int w, int h) { 30 | this.w = w; 31 | this.h = h; 32 | 33 | System.out.println("Loading: " + file + "..."); 34 | FONTSHEET = loadFont(file); 35 | 36 | wLetter = FONTSHEET.getWidth() / w; 37 | hLetter = FONTSHEET.getHeight() / h; 38 | loadFontArray(); 39 | } 40 | 41 | public void setSize(int width, int height) { 42 | setWidth(width); 43 | setHeight(height); 44 | } 45 | 46 | public void setWidth(int i) { 47 | w = i; 48 | wLetter = FONTSHEET.getWidth() / w; 49 | } 50 | 51 | public void setHeight(int i) { 52 | h = i; 53 | hLetter = FONTSHEET.getHeight() / h; 54 | } 55 | 56 | public int getWidth() { 57 | return w; 58 | } 59 | 60 | public int getHeight() { 61 | return h; 62 | } 63 | 64 | private BufferedImage loadFont(String file) { 65 | BufferedImage sprite = null; 66 | try { 67 | sprite = ImageIO.read(getClass().getClassLoader().getResourceAsStream(file)); 68 | } catch (Exception e) { 69 | System.out.println("ERROR: could not load file: " + file); 70 | } 71 | 72 | return sprite; 73 | } 74 | 75 | public void loadFontArray() { 76 | spriteArray = new BufferedImage[wLetter][hLetter]; 77 | 78 | for (int x = 0; x < wLetter; x++) { 79 | for (int y = 0; y < hLetter; y++) { 80 | spriteArray[x][y] = getLetter(x, y); 81 | } 82 | } 83 | } 84 | 85 | public BufferedImage getFontSheet() { 86 | return FONTSHEET; 87 | } 88 | 89 | public BufferedImage getLetter(int x, int y) { 90 | BufferedImage img = FONTSHEET.getSubimage(x * w, y * h, w, h); 91 | return img; 92 | } 93 | 94 | public BufferedImage getLetter(char letter) { 95 | int value = letter; 96 | 97 | int x = value % wLetter; 98 | int y = value / wLetter; 99 | return getLetter(x, y); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/graphics/Fontf.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.graphics; 2 | 3 | import java.awt.GraphicsEnvironment; 4 | import java.awt.Font; 5 | import java.util.HashMap; 6 | 7 | public class Fontf { 8 | 9 | private HashMap fonts; 10 | 11 | public Fontf() { 12 | fonts = new HashMap(); 13 | } 14 | 15 | public void loadFont(String path, String name) { 16 | try { 17 | System.out.println("Loading: " + path + "..."); 18 | Font customFont = Font.createFont(Font.TRUETYPE_FONT, getClass().getClassLoader().getResourceAsStream(path)); 19 | GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); 20 | ge.registerFont(customFont); 21 | 22 | Font font = new Font(name, Font.PLAIN, 32); 23 | 24 | fonts.put(name, font); 25 | } catch (Exception e) { 26 | System.out.println("ERROR: ttfFont - can't load font " + path + "..."); 27 | e.printStackTrace(); 28 | } 29 | } 30 | 31 | public Font getFont(String name) { 32 | return fonts.get(name); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/graphics/Sprite.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.graphics; 2 | 3 | import com.zerulus.game.math.Matrix; 4 | 5 | import java.awt.Color; 6 | import java.awt.image.BufferedImage; 7 | 8 | public class Sprite { 9 | 10 | public BufferedImage image; 11 | 12 | private int[] pixels; 13 | private int[] ogpixels; 14 | 15 | private int w; 16 | private int h; 17 | 18 | public static enum effect {NORMAL, SEPIA, REDISH, GRAYSCALE, NEGATIVE, DECAY}; 19 | 20 | private float[][] id = {{1.0f, 0.0f, 0.0f}, 21 | {0.0f, 1.0f, 0.0f}, 22 | {0.0f, 0.0f, 1.0f}, 23 | {0.0f, 0.0f, 0.0f}}; 24 | 25 | private float[][] negative = {{1.0f, 0.0f, 0.0f}, 26 | {0.0f, 1.0f, 0.0f}, 27 | {0.0f, 0.0f, 1.0f}, 28 | {0.0f, 0.0f, 0.0f}}; 29 | 30 | private float[][] decay = {{0.000f, 0.333f, 0.333f}, 31 | {0.333f, 0.000f, 0.333f}, 32 | {0.333f, 0.333f, 0.000f}, 33 | {0.000f, 0.000f, 0.000f}}; 34 | 35 | private float[][] sepia = {{0.393f, 0.349f, 0.272f}, 36 | {0.769f, 0.686f, 0.534f}, 37 | {0.189f, 0.168f, 0.131f}, 38 | {0.000f, 0.000f, 0.000f}}; 39 | 40 | private float[][] redish = {{1.0f, 0.0f, 0.0f}, 41 | {0.0f, 0.3f, 0.0f}, 42 | {0.0f, 0.0f, 0.3f}, 43 | {0.0f, 0.0f, 0.0f}}; 44 | 45 | private float[][] grayscale = {{0.333f, 0.333f, 0.333f}, 46 | {0.333f, 0.333f, 0.333f}, 47 | {0.333f, 0.333f, 0.333f}, 48 | {0.000f, 0.000f, 0.000f}}; 49 | 50 | private float[][] currentEffect = id; 51 | 52 | public Sprite(BufferedImage image) { 53 | this.image = image; 54 | this.w = image.getWidth(); 55 | this.h = image.getHeight(); 56 | ogpixels = image.getRGB(0, 0, w, h, ogpixels, 0, w); 57 | pixels = ogpixels; 58 | } 59 | 60 | public int getWidth() { return w; } 61 | public int getHeight() { return h; } 62 | 63 | public void saveColors() { 64 | pixels = image.getRGB(0, 0, w, h, pixels, 0, w); 65 | currentEffect = id; 66 | } 67 | 68 | public void restoreColors() { 69 | image.setRGB(0, 0, w, h, pixels, 0, w); 70 | } 71 | 72 | public void restoreDefault() { 73 | image.setRGB(0, 0, w, h, ogpixels, 0, w); 74 | } 75 | 76 | // in #FFFFFF format 77 | public Color hexToColor(String color) { 78 | return new Color( 79 | Integer.valueOf(color.substring(1, 3), 16), 80 | Integer.valueOf(color.substring(3, 5), 16), 81 | Integer.valueOf(color.substring(5, 7), 16)); 82 | } 83 | 84 | public void setContrast(float value) { 85 | float[][] effect = id; 86 | float contrast = (259 * (value + 255)) / (255 * (259 - value)); 87 | for(int i = 0; i < 3; i++) { 88 | if(i < 3) 89 | effect[i][i] = contrast; 90 | effect[3][i] = 128 * (1 - contrast); 91 | } 92 | 93 | addEffect(effect); 94 | } 95 | 96 | public void setBrightness(float value) { 97 | float[][] effect = id; 98 | for(int i = 0; i < 3; i++) 99 | effect[3][i] = value; 100 | 101 | addEffect(effect); 102 | } 103 | 104 | public void setEffect(effect e) { 105 | float[][] effect; 106 | switch (e) { 107 | case SEPIA: effect = sepia; 108 | break; 109 | case REDISH: effect = redish; 110 | break; 111 | case GRAYSCALE: effect = grayscale; 112 | break; 113 | case NEGATIVE: effect = negative; 114 | break; 115 | case DECAY: effect = decay; 116 | break; 117 | default: effect = id; 118 | } 119 | 120 | if(effect != currentEffect) { 121 | addEffect(effect); 122 | } 123 | } 124 | 125 | private void addEffect(float[][] effect) { 126 | float[][] rgb = new float[1][4]; 127 | float[][] xrgb; 128 | for(int x = 0; x < w; x++) { 129 | for(int y = 0; y < h; y++) { 130 | int p = pixels[x + y * w]; 131 | 132 | int a = (p >> 24) & 0xff; 133 | 134 | rgb[0][0] = (p >> 16) & 0xff; 135 | rgb[0][1] = (p >> 8) & 0xff; 136 | rgb[0][2] = (p) & 0xff; 137 | rgb[0][3] = 1f; 138 | 139 | xrgb = Matrix.multiply(rgb, effect); 140 | 141 | for(int i = 0; i < 3; i++) { 142 | if(xrgb[0][i] > 255) rgb[0][i] = 255; 143 | else if(xrgb[0][i] < 0) rgb[0][i] = 0; 144 | else rgb[0][i] = xrgb[0][i]; 145 | } 146 | 147 | p = (a<<24) | ((int) rgb[0][0]<<16) | ((int) rgb[0][1]<<8) | (int) rgb[0][2]; 148 | image.setRGB(x, y, p); 149 | } 150 | } 151 | currentEffect = effect; 152 | } 153 | 154 | public Sprite getSubimage(int x, int y, int w, int h) { 155 | return new Sprite(image.getSubimage(x, y, w, h)); 156 | } 157 | 158 | public Sprite getNewSubimage(int x, int y, int w, int h) { 159 | BufferedImage temp = image.getSubimage(x, y, w, h); 160 | BufferedImage newImage = new BufferedImage(image.getColorModel(), image.getRaster().createCompatibleWritableRaster(w,h), image.isAlphaPremultiplied(), null); 161 | temp.copyData(newImage.getRaster()); 162 | return new Sprite(newImage); 163 | } 164 | 165 | public Sprite getNewSubimage() { 166 | return getNewSubimage(0, 0, this.w, this.h); 167 | } 168 | } 169 | 170 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/graphics/SpriteSheet.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.graphics; 2 | 3 | import java.awt.Graphics2D; 4 | import java.awt.image.BufferedImage; 5 | import java.util.ArrayList; 6 | 7 | import javax.imageio.ImageIO; 8 | 9 | import com.zerulus.game.math.Vector2f; 10 | 11 | public class SpriteSheet { 12 | 13 | private Sprite SPRITESHEET = null; 14 | private Sprite[][] spriteArray; 15 | private final int TILE_SIZE = 32; 16 | public int w; 17 | public int h; 18 | private int wSprite; 19 | private int hSprite; 20 | private String file; 21 | 22 | public static Font currentFont; 23 | 24 | public SpriteSheet(String file) { 25 | this.file = file; 26 | w = TILE_SIZE; 27 | h = TILE_SIZE; 28 | 29 | System.out.println("Loading: " + file + "..."); 30 | SPRITESHEET = new Sprite(loadSprite(file)); 31 | 32 | wSprite = SPRITESHEET.image.getWidth() / w; 33 | hSprite = SPRITESHEET.image.getHeight() / h; 34 | loadSpriteArray(); 35 | } 36 | 37 | public SpriteSheet(Sprite sprite, String name, int w, int h) { 38 | this.w = w; 39 | this.h = h; 40 | 41 | System.out.println("Loading: " + name + "..."); 42 | SPRITESHEET = sprite; 43 | 44 | wSprite = SPRITESHEET.image.getWidth() / w; 45 | hSprite = SPRITESHEET.image.getHeight() / h; 46 | loadSpriteArray(); 47 | 48 | } 49 | 50 | public SpriteSheet(String file, int w, int h) { 51 | this.w = w; 52 | this.h = h; 53 | this.file = file; 54 | 55 | System.out.println("Loading: " + file + "..."); 56 | SPRITESHEET = new Sprite(loadSprite(file)); 57 | 58 | wSprite = SPRITESHEET.image.getWidth() / w; 59 | hSprite = SPRITESHEET.image.getHeight() / h; 60 | loadSpriteArray(); 61 | } 62 | 63 | public void setSize(int width, int height) { 64 | setWidth(width); 65 | setHeight(height); 66 | } 67 | 68 | public void setWidth(int i) { 69 | w = i; 70 | wSprite = SPRITESHEET.image.getWidth() / w; 71 | } 72 | 73 | public void setHeight(int i) { 74 | h = i; 75 | hSprite = SPRITESHEET.image.getHeight() / h; 76 | } 77 | 78 | public int getWidth() { return w; } 79 | public int getHeight() { return h; } 80 | public int getRows() { return hSprite; } 81 | public int getCols() { return wSprite; } 82 | public int getTotalTiles() { return wSprite * hSprite; } 83 | public String getFilename() { return file; } 84 | 85 | private BufferedImage loadSprite(String file) { 86 | BufferedImage sprite = null; 87 | try { 88 | sprite = ImageIO.read(getClass().getClassLoader().getResourceAsStream(file)); 89 | } catch (Exception e) { 90 | System.out.println("ERROR: could not load file: " + file); 91 | } 92 | return sprite; 93 | } 94 | 95 | public void loadSpriteArray() { 96 | spriteArray = new Sprite[hSprite][wSprite]; 97 | 98 | for (int y = 0; y < hSprite; y++) { 99 | for (int x = 0; x < wSprite; x++) { 100 | spriteArray[y][x] = getSprite(x, y); 101 | } 102 | } 103 | } 104 | 105 | public void setEffect(Sprite.effect e) { 106 | SPRITESHEET.setEffect(e); 107 | } 108 | 109 | public Sprite getSpriteSheet() { 110 | return SPRITESHEET; 111 | } 112 | 113 | public Sprite getSprite(int x, int y) { 114 | return SPRITESHEET.getSubimage(x * w, y * h, w, h); 115 | } 116 | 117 | public Sprite getNewSprite(int x, int y) { 118 | return SPRITESHEET.getNewSubimage(x * w, y * h, w, h); 119 | } 120 | 121 | public Sprite getSprite(int x, int y, int w, int h) { 122 | return SPRITESHEET.getSubimage(x * w, y * h, w, h); 123 | } 124 | 125 | public BufferedImage getSubimage(int x, int y, int w, int h) { 126 | return SPRITESHEET.image.getSubimage(x, y, w, h); 127 | } 128 | 129 | public Sprite[] getSpriteArray(int i) { 130 | return spriteArray[i]; 131 | } 132 | 133 | public Sprite[][] getSpriteArray2() { 134 | return spriteArray; 135 | } 136 | 137 | public static void drawArray(Graphics2D g, ArrayList img, Vector2f pos, int width, int height, int xOffset, int yOffset) { 138 | float x = pos.x; 139 | float y = pos.y; 140 | 141 | for (int i = 0; i < img.size(); i++) { 142 | if (img.get(i) != null) { 143 | g.drawImage(img.get(i).image, (int) x, (int) y, width, height, null); 144 | } 145 | 146 | x += xOffset; 147 | y += yOffset; 148 | } 149 | } 150 | 151 | public static void drawArray(Graphics2D g, String word, Vector2f pos, int size) { 152 | drawArray(g, currentFont, word, pos, size, size, size, 0); 153 | } 154 | 155 | public static void drawArray(Graphics2D g, String word, Vector2f pos, int size, int xOffset) { 156 | drawArray(g, currentFont, word, pos, size, size, xOffset, 0); 157 | } 158 | 159 | public static void drawArray(Graphics2D g, String word, Vector2f pos, int width, int height, int xOffset) { 160 | drawArray(g, currentFont, word, pos, width, height, xOffset, 0); 161 | } 162 | 163 | public static void drawArray(Graphics2D g, Font f, String word, Vector2f pos, int size, int xOffset) { 164 | drawArray(g, f, word, pos, size, size, xOffset, 0); 165 | } 166 | 167 | public static void drawArray(Graphics2D g, Font f, String word, Vector2f pos, int width, int height, int xOffset, int yOffset) { 168 | float x = pos.x; 169 | float y = pos.y; 170 | 171 | currentFont = f; 172 | 173 | for (int i = 0; i < word.length(); i++) { 174 | if (word.charAt(i) != 32) 175 | g.drawImage(f.getLetter(word.charAt(i)), (int) x, (int) y, width, height, null); 176 | 177 | x += xOffset; 178 | y += yOffset; 179 | } 180 | 181 | } 182 | 183 | } 184 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/math/AABB.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.math; 2 | 3 | import java.util.ArrayList; 4 | 5 | import com.zerulus.game.entity.GameObject; 6 | 7 | public class AABB { 8 | 9 | private Vector2f pos; 10 | private float xOffset = 0; 11 | private float yOffset = 0; 12 | private float w; 13 | private float h; 14 | private float r; 15 | private int size; 16 | 17 | private float surfaceArea; 18 | 19 | public AABB(Vector2f pos, int w, int h) { 20 | this.pos = pos; 21 | this.w = w; 22 | this.h = h; 23 | this.surfaceArea = w * h; 24 | 25 | size = Math.max(w, h); 26 | } 27 | 28 | public AABB(Vector2f pos, int r) { 29 | this.pos = pos; 30 | this.r = r; 31 | this.surfaceArea = (float) Math.PI * (r * r); 32 | 33 | size = r; 34 | } 35 | 36 | public Vector2f getPos() { return pos; } 37 | 38 | public float getRadius() { return r; } 39 | public float getSize() { return size; } 40 | public float getWidth() { return w; } 41 | public float getHeight() { return h; } 42 | public float getSurfaceArea() { return surfaceArea; } 43 | 44 | public void setBox(Vector2f pos, int w, int h) { 45 | this.pos = pos; 46 | this.w = w; 47 | this.h = h; 48 | 49 | size = Math.max(w, h); 50 | } 51 | 52 | public void setCircle(Vector2f pos, int r) { 53 | this.pos = pos; 54 | this.r = r; 55 | 56 | size = r; 57 | } 58 | 59 | public void setWidth(float f) { w = f; } 60 | public void setHeight(float f) { h = f; } 61 | 62 | public void setXOffset(float f) { xOffset = f; } 63 | public void setYOffset(float f) { yOffset = f; } 64 | public float getXOffset() { return xOffset; } 65 | public float getYOffset() { return yOffset; } 66 | 67 | public boolean collides(AABB bBox) { 68 | return collides(0, 0, bBox); 69 | } 70 | 71 | public boolean collides(float dx, float dy, ArrayList go) { 72 | boolean collides = false; 73 | 74 | for(int i = 0; i < go.size(); i++) { 75 | collides = collides(dx, dy, go.get(i).getBounds()); 76 | if(collides) { 77 | go.get(i).getImage().restoreDefault(); 78 | go.remove(i); 79 | return collides; 80 | } 81 | } 82 | 83 | return collides; 84 | } 85 | 86 | public boolean collides(float dx, float dy, AABB bBox) { 87 | float ax = ((pos.x + (xOffset)) + (this.w / 2)) + dx; 88 | float ay = ((pos.y + (yOffset)) + (this.h / 2)) + dy; 89 | float bx = ((bBox.getPos().x + (bBox.getXOffset())) + (bBox.getWidth() / 2)); 90 | float by = ((bBox.getPos().y + (bBox.getYOffset())) + (bBox.getHeight() / 2)); 91 | 92 | if (Math.abs(ax - bx) < (this.w / 2) + (bBox.getWidth() / 2)) { 93 | if (Math.abs(ay - by) < (this.h / 2) + (bBox.getHeight() / 2)) { 94 | return true; 95 | } 96 | } 97 | 98 | return false; 99 | } 100 | 101 | public boolean inside(int xp, int yp) { 102 | if(xp == -1 || yp == - 1) return false; 103 | 104 | int wTemp = (int) this.w; 105 | int hTemp = (int) this.h; 106 | int x = (int) this.pos.x; 107 | int y = (int) this.pos.y; 108 | 109 | if(xp < x || yp < y) { 110 | return false; 111 | } 112 | 113 | wTemp += x; 114 | hTemp += y; 115 | return ((wTemp < x || wTemp > xp) && (hTemp < y || hTemp > yp)); 116 | } 117 | 118 | public boolean intersect(AABB aBox) 119 | { 120 | 121 | if((pos.x + xOffset > aBox.getPos().x + aBox.getXOffset() + aBox.getSize()) 122 | || (aBox.getPos().x + xOffset > pos.x + aBox.getXOffset() + aBox.getSize())) 123 | { 124 | return false; 125 | } 126 | 127 | if((pos.y + yOffset > aBox.getPos().y + aBox.getYOffset() + aBox.getSize()) 128 | || (aBox.getPos().y + yOffset > pos.y + aBox.getYOffset() + aBox.getSize())) 129 | { 130 | return false; 131 | } 132 | 133 | return true; 134 | } 135 | 136 | public boolean colCircle(AABB circle) { 137 | 138 | float totalRadius = r + circle.getRadius(); 139 | totalRadius *= totalRadius; 140 | 141 | float dx = (pos.x + circle.getPos().x); 142 | float dy = (pos.y + circle.getPos().y); 143 | 144 | return totalRadius < (dx * dx) + (dy * dy); 145 | } 146 | 147 | public boolean colCircleBox(AABB aBox) { 148 | 149 | float dx = Math.max(aBox.getPos().x + aBox.getXOffset(), Math.min(pos.x + (r / 2), aBox.getPos().x + aBox.getXOffset() + aBox.getWidth())); 150 | float dy = Math.max(aBox.getPos().y + aBox.getYOffset(), Math.min(pos.y + (r / 2), aBox.getPos().y + aBox.getYOffset() + aBox.getHeight())); 151 | 152 | dx = pos.x + (r / 2) - dx; 153 | dy = pos.y + (r / 2) - dy; 154 | 155 | if(Math.sqrt(dx * dx + dy * dy) < r / 2) { 156 | return true; 157 | } 158 | 159 | return false; 160 | } 161 | 162 | public float distance(Vector2f other) { 163 | float dx = pos.x - other.x; 164 | float dy = pos.y - other.y; 165 | return (float) Math.sqrt(dx * dx + dy * dy); 166 | } 167 | 168 | public AABB merge(AABB other) { 169 | float minX = Math.min(pos.x, other.getPos().x); 170 | float minY = Math.min(pos.y, other.getPos().y); 171 | 172 | int maxW = (int) Math.max(w, other.getWidth()); 173 | int maxH = (int) Math.max(h, other.getHeight()); 174 | 175 | Vector2f pos = new Vector2f(minX, minY); 176 | return new AABB(pos, maxW, maxH); 177 | } 178 | 179 | public String toString() { 180 | 181 | String x = Float.toString(pos.x); 182 | String y = Float.toString(pos.y); 183 | String w = Float.toString(this.w); 184 | String h = Float.toString(this.h); 185 | 186 | return "{" + x + ", " + y + " : " + w + ", " + h + "}"; 187 | } 188 | 189 | 190 | } 191 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/math/Matrix.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.math; 2 | 3 | public class Matrix { 4 | 5 | public static float[][] multiply(float[][] aMatrix, float[][] bMatrix) { 6 | if(aMatrix[0].length != bMatrix.length) { 7 | System.out.println("ERROR: A matrix columns does not equal B matrix rows"); 8 | return identity(aMatrix); 9 | } 10 | 11 | float[][] outMatrix = new float[aMatrix.length][bMatrix[0].length]; 12 | 13 | float temp; 14 | for(int i = 0; i < aMatrix.length; i++) { 15 | for(int j = 0; j < bMatrix[0].length; j++) { 16 | temp = 0; 17 | for(int k = 0; k < aMatrix[0].length; k++) { 18 | temp += aMatrix[i][k] * bMatrix[k][j]; 19 | } 20 | outMatrix[i][j] = temp; 21 | } 22 | } 23 | 24 | return outMatrix; 25 | } 26 | 27 | public static float[][] multiply(float[][] matrix, float value) { 28 | float[][] outMatrix = new float[matrix.length][matrix[0].length]; 29 | 30 | for(int i = 0; i < matrix.length; i++) { 31 | for(int j = 0; j < matrix[0].length; j++) { 32 | outMatrix[i][j] = value * matrix[i][j]; 33 | } 34 | } 35 | 36 | return outMatrix; 37 | } 38 | 39 | public static float[][] add(float[][] aMatrix, float[][] bMatrix) { 40 | if(aMatrix.length != bMatrix.length || aMatrix[0].length != bMatrix[0].length ) { 41 | System.out.println("ERROR: A matrix dimensions does not equal B matrix dimensions"); 42 | return identity(aMatrix); 43 | } 44 | 45 | float[][] outMatrix = new float[aMatrix.length][bMatrix[0].length]; 46 | 47 | for(int i = 0; i < aMatrix.length; i++) { 48 | for(int j = 0; j < bMatrix[0].length; j++) { 49 | outMatrix[i][j] = aMatrix[i][j] + bMatrix[i][j]; 50 | } 51 | } 52 | 53 | return outMatrix; 54 | } 55 | 56 | public static float[][] add(float[][] matrix, float value) { 57 | float[][] outMatrix = new float[matrix.length][matrix[0].length]; 58 | 59 | for(int i = 0; i < matrix.length; i++) { 60 | for(int j = 0; j < matrix[0].length; j++) { 61 | outMatrix[i][j] = value + matrix[i][j]; 62 | } 63 | } 64 | 65 | return outMatrix; 66 | } 67 | 68 | public static float[][] inverse(float[][] matrix) { 69 | float[][] inverse = new float[matrix.length][matrix[0].length]; 70 | 71 | for(int i = 0; i < matrix.length; i++){ 72 | for(int j = 0; j < matrix[i].length; j++) { 73 | inverse[i][j] = (float) Math.pow(-1, i + j) * determinant(minor(matrix, i, j)); 74 | } 75 | } 76 | 77 | float det = 1.0f / determinant(matrix); 78 | for (int i = 0; i < inverse.length; i++) { 79 | for (int j = 0; j <= i; j++) { 80 | float temp = inverse[i][j]; 81 | inverse[i][j] = inverse[j][i] * det; 82 | inverse[j][i] = temp * det; 83 | } 84 | } 85 | 86 | return inverse; 87 | } 88 | 89 | public static float[][] transpose(float[][] matrix) { 90 | float[][] transpose = new float[matrix[0].length][matrix.length]; 91 | 92 | for (int i = 0; i < matrix.length; i++) 93 | for (int j = 0; j < matrix[i].length; j++) 94 | transpose[j][i] = matrix[i][j]; 95 | return transpose; 96 | } 97 | 98 | private static float determinant(float[][] matrix) { 99 | if(matrix.length == 2) { 100 | System.out.println(matrix[0][1]); 101 | return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]; 102 | } 103 | 104 | float det = 0; 105 | for(int i = 0; i < matrix[0].length; i++) { 106 | det += Math.pow(-1, i) * matrix[0][i] * determinant(minor(matrix, 0, i)); 107 | } 108 | 109 | return det; 110 | } 111 | 112 | private static float[][] minor(float[][] matrix, int row, int col) { 113 | float[][] outMatrix = new float[matrix.length - 1][matrix[0].length - 1]; 114 | 115 | for(int i = 0; i < matrix.length; i++) { 116 | for(int j = 0; j < matrix[0].length; j++) { 117 | if(i != row && j != col) { 118 | outMatrix[i < row ? i : i - 1][j < col ? j : j - 1] = matrix[i][j]; 119 | } 120 | } 121 | } 122 | 123 | return outMatrix; 124 | } 125 | 126 | private static float[][] identity(float[][] matrix) { 127 | float[][] outMatrix = new float[matrix.length][matrix.length]; 128 | 129 | for(int i = 0; i < matrix.length; i++) { 130 | outMatrix[i][i] = 1; 131 | } 132 | 133 | return outMatrix; 134 | } 135 | 136 | public static void print(float[][] matrix) { 137 | for(int i = 0; i < matrix.length; i++) { 138 | for(int j = 0; j < matrix[0].length; j++) { 139 | System.out.print(matrix[i][j] + ","); 140 | } 141 | System.out.println(); 142 | } 143 | } 144 | 145 | 146 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/math/Vector2f.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.math; 2 | 3 | 4 | public class Vector2f { 5 | 6 | public float x; 7 | public float y; 8 | 9 | public static float worldX; 10 | public static float worldY; 11 | 12 | public Vector2f() { 13 | x = 0; 14 | y = 0; 15 | } 16 | 17 | public Vector2f(Vector2f vec) { 18 | new Vector2f(vec.x, vec.y); 19 | } 20 | 21 | public Vector2f(float x, float y) { 22 | this.x = x; 23 | this.y = y; 24 | } 25 | 26 | public void addX(float f) { x += f; } 27 | public void addY(float f) { y += f; } 28 | 29 | public void setX(float f) { x = f; } 30 | public void setY(float f) { y = f; } 31 | 32 | public void setVector(Vector2f vec) { 33 | this.x = vec.x; 34 | this.y = vec.y; 35 | } 36 | 37 | public void setVector(float x, float y) { 38 | this.x = x; 39 | this.y = y; 40 | } 41 | 42 | public static void setWorldVar(float x, float y) { 43 | worldX = x; 44 | worldY = y; 45 | } 46 | 47 | public static float getWorldVarX(float x) { 48 | return x - worldX; 49 | } 50 | 51 | public static float getWorldVarY(float y) { 52 | return y - worldY; 53 | } 54 | 55 | public Vector2f getWorldVar() { 56 | return new Vector2f(x - worldX, y - worldY); 57 | } 58 | 59 | @Override 60 | public String toString() { 61 | return x + ", " + y; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/noise/SimplexNoise.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.noise; 2 | 3 | import java.util.Random; 4 | 5 | public class SimplexNoise { 6 | 7 | SimplexNoise_octave[] octaves; 8 | double[] frequencys; 9 | double[] amplitudes; 10 | 11 | int largestFeature; 12 | double persistence; 13 | int seed; 14 | 15 | public SimplexNoise(int largestFeature, double persistence, int seed){ 16 | this.largestFeature = largestFeature; 17 | this.persistence = persistence; 18 | this.seed = seed; 19 | 20 | //recieves a number (eg 128) and calculates what power of 2 it is (eg 2^7) 21 | int numberOfOctaves = (int) Math.ceil(Math.log10(largestFeature) / Math.log10(2)); 22 | 23 | octaves = new SimplexNoise_octave[numberOfOctaves]; 24 | frequencys = new double[numberOfOctaves]; 25 | amplitudes = new double[numberOfOctaves]; 26 | 27 | Random rnd = new Random(seed); 28 | 29 | for(int i = 0;i < numberOfOctaves; i++){ 30 | octaves[i] = new SimplexNoise_octave(rnd.nextInt()); 31 | 32 | frequencys[i] = Math.pow(2, i); 33 | amplitudes[i] = Math.pow(persistence, octaves.length - i); 34 | } 35 | } 36 | 37 | 38 | public double getNoise(int x, int y){ 39 | 40 | double result = 0; 41 | 42 | for(int i = 0; i < octaves.length; i++){ 43 | //double frequency = Math.pow(2,i); 44 | //double amplitude = Math.pow(persistence,octaves.length-i); 45 | 46 | result = result + octaves[i].noise(x / frequencys[i], y / frequencys[i]) * amplitudes[i]; 47 | } 48 | 49 | return result; 50 | } 51 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/noise/SimplexNoise_octave.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.noise; 2 | 3 | import java.util.Random; 4 | 5 | 6 | /* 7 | * A speed-improved simplex noise algorithm for 2D, 3D and 4D in Java. 8 | * 9 | * Based on example code by Stefan Gustavson (stegu@itn.liu.se). 10 | * Optimisations by Peter Eastman (peastman@drizzle.stanford.edu). 11 | * Better rank ordering method by Stefan Gustavson in 2012. 12 | * 13 | * This could be speeded up even further, but it's useful as it is. 14 | * 15 | * Version 2012-03-09 16 | * 17 | * This code was placed in the public domain by its original author, 18 | * Stefan Gustavson. You may use it as you see fit, but 19 | * attribution is appreciated. 20 | * 21 | */ 22 | 23 | public class SimplexNoise_octave { // Simplex noise in 2D, 3D and 4D 24 | 25 | public static int RANDOMSEED = 0; 26 | private static int NUMBEROFSWAPS = 400; 27 | 28 | private static Grad grad3[] = {new Grad(1,1,0),new Grad(-1,1,0),new Grad(1,-1,0),new Grad(-1,-1,0), 29 | new Grad(1,0,1),new Grad(-1,0,1),new Grad(1,0,-1),new Grad(-1,0,-1), 30 | new Grad(0,1,1),new Grad(0,-1,1),new Grad(0,1,-1),new Grad(0,-1,-1)}; 31 | 32 | private static short p_supply[] = {151,160,137,91,90,15, //this contains all the numbers between 0 and 255, these are put in a random order depending upon the seed 33 | 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, 34 | 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, 35 | 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, 36 | 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, 37 | 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, 38 | 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, 39 | 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, 40 | 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, 41 | 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, 42 | 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, 43 | 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, 44 | 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180}; 45 | 46 | private short p[] = new short[p_supply.length]; 47 | 48 | // To remove the need for index wrapping, double the permutation table length 49 | private short perm[] = new short[512]; 50 | private short permMod12[] = new short[512]; 51 | public SimplexNoise_octave(int seed) { 52 | p = p_supply.clone(); 53 | 54 | if (seed == RANDOMSEED){ 55 | Random rand = new Random(); 56 | seed = rand.nextInt(); 57 | } 58 | 59 | //the random for the swaps 60 | Random rand = new Random(seed); 61 | 62 | //the seed determines the swaps that occur between the default order and the order we're actually going to use 63 | for(int i = 0; i < NUMBEROFSWAPS; i++) { 64 | int swapFrom = rand.nextInt(p.length); 65 | int swapTo = rand.nextInt(p.length); 66 | 67 | short temp = p[swapFrom]; 68 | p[swapFrom] = p[swapTo]; 69 | p[swapTo] = temp; 70 | } 71 | 72 | 73 | for(int i = 0; i < 512; i++) { 74 | perm[i] = p[i & 255]; 75 | permMod12[i] = (short) (perm[i] % 12); 76 | } 77 | } 78 | 79 | // Skewing and unskewing factors for 2, 3, and 4 dimensions 80 | private static final double F2 = 0.5 * (Math.sqrt(3.0) - 1.0); 81 | private static final double G2 = (3.0 - Math.sqrt(3.0)) / 6.0; 82 | 83 | // This method is a *lot* faster than using (int)Math.floor(x) 84 | private static int fastfloor(double x) { 85 | int xi = (int) x; 86 | return x < xi ? xi - 1 : xi; 87 | } 88 | 89 | private static double dot(Grad g, double x, double y) { 90 | return g.x * x + g.y * y; 91 | } 92 | 93 | // 2D simplex noise 94 | public double noise(double xin, double yin) { 95 | double n0, n1, n2; // Noise contributions from the three corners 96 | // Skew the input space to determine which simplex cell we're in 97 | double s = (xin + yin) * F2; // Hairy factor for 2D 98 | int i = fastfloor(xin + s); 99 | int j = fastfloor(yin + s); 100 | double t = (i + j) * G2; 101 | double X0 = i - t; // Unskew the cell origin back to (x,y) space 102 | double Y0 = j - t; 103 | double x0 = xin - X0; // The x,y distances from the cell origin 104 | double y0 = yin - Y0; 105 | 106 | // For the 2D case, the simplex shape is an equilateral triangle. 107 | // Determine which simplex we are in. 108 | int i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords 109 | if(x0 > y0) {i1 = 1; j1 = 0;} // lower triangle, XY order: (0,0)->(1,0)->(1,1) 110 | else {i1 = 0; j1 = 1;} // upper triangle, YX order: (0,0)->(0,1)->(1,1) 111 | // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and 112 | // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where 113 | // c = (3-sqrt(3))/6 114 | double x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords 115 | double y1 = y0 - j1 + G2; 116 | double x2 = x0 - 1.0 + 2.0 * G2; // Offsets for last corner in (x,y) unskewed coords 117 | double y2 = y0 - 1.0 + 2.0 * G2; 118 | // Work out the hashed gradient indices of the three simplex corners 119 | int ii = i & 255; 120 | int jj = j & 255; 121 | int gi0 = permMod12[ii + perm[jj]]; 122 | int gi1 = permMod12[ii + i1 + perm[jj + j1]]; 123 | int gi2 = permMod12[ii + 1 + perm[jj + 1]]; 124 | 125 | // Calculate the contribution from the three corners 126 | double t0 = 0.5 - x0 * x0 - y0 * y0; 127 | if(t0 < 0) n0 = 0.0; 128 | else { 129 | t0 *= t0; 130 | n0 = t0 * t0 * dot(grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient 131 | } 132 | 133 | double t1 = 0.5 - x1 * x1 - y1 * y1; 134 | if(t1 < 0) n1 = 0.0; 135 | else { 136 | t1 *= t1; 137 | n1 = t1 * t1 * dot(grad3[gi1], x1, y1); 138 | } 139 | 140 | double t2 = 0.5 - x2 * x2 - y2 * y2; 141 | if(t2 < 0) n2 = 0.0; 142 | else { 143 | t2 *= t2; 144 | n2 = t2 * t2 * dot(grad3[gi2], x2, y2); 145 | } 146 | // Add contributions from each corner to get the final noise value. 147 | // The result is scaled to return values in the interval [-1,1]. 148 | return 70.0 * (n0 + n1 + n2); 149 | } 150 | 151 | 152 | // Inner class to speed upp gradient computations 153 | // (array access is a lot slower than member access) 154 | private static class Grad 155 | { 156 | double x, y, z; 157 | 158 | Grad(double x, double y, double z) 159 | { 160 | this.x = x; 161 | this.y = y; 162 | this.z = z; 163 | } 164 | } 165 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/states/EditState.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.states; 2 | 3 | import com.zerulus.game.GamePanel; 4 | import com.zerulus.game.entity.GameObject; 5 | import com.zerulus.game.entity.enemy.TinyMon; 6 | import com.zerulus.game.graphics.SpriteSheet; 7 | import com.zerulus.game.util.KeyHandler; 8 | import com.zerulus.game.util.MouseHandler; 9 | import com.zerulus.game.math.Vector2f; 10 | import com.zerulus.game.util.Camera; 11 | import com.zerulus.game.ui.Button; 12 | 13 | import java.awt.image.BufferedImage; 14 | import java.awt.Graphics2D; 15 | 16 | public class EditState extends GameState { 17 | 18 | private BufferedImage imgButton; 19 | private Button btnEnemy1; 20 | private Button btnEnemy2; 21 | private boolean clicked = false; 22 | 23 | private GameObject gameObject = null; 24 | private PlayState ps; 25 | private Camera cam; 26 | 27 | private int selection = 0; 28 | private GameObject e_enemy1; 29 | private GameObject e_enemy2; 30 | private GameObject[] entityList = {gameObject, e_enemy1, e_enemy2}; 31 | private int count = 0; 32 | 33 | 34 | public EditState(GameStateManager gsm, Camera cam) { 35 | super(gsm); 36 | imgButton = GameStateManager.ui.getSprite(0, 0, 128, 64).image; 37 | this.ps = (PlayState) gsm.getState(GameStateManager.PLAY); 38 | this.cam = cam; 39 | 40 | SpriteSheet enemySheet = new SpriteSheet("entity/enemy/minimonsters.png", 16, 16); 41 | 42 | btnEnemy1 = new Button("TinyMon", new Vector2f(64 + 24, 64 + 24), 32, 24, imgButton, new Vector2f(64, 64), 220, 75); 43 | btnEnemy1.addEvent(e -> { 44 | selection = 1; 45 | entityList[1] = new TinyMon(cam, new SpriteSheet(enemySheet.getSprite(0, 0, 128, 32), "tiny monster", 16, 16), 46 | new Vector2f((GamePanel.width / 2) - 32 + 150, 0 + (GamePanel.height / 2) - 32 + 150), 48); 47 | }); 48 | 49 | btnEnemy2 = new Button("TinyBoar", new Vector2f(64 + 24, (64 + 24) * 2), 32, 24, imgButton, new Vector2f(64, 64 + 85), 235, 75); 50 | btnEnemy2.addEvent(e -> { 51 | selection = 2; 52 | entityList[2] = new TinyMon(cam, new SpriteSheet(enemySheet.getSprite(0, 1, 128, 32), "tiny boar", 16, 16), 53 | new Vector2f((GamePanel.width / 2) - 32 + 150, 0 + (GamePanel.height / 2) - 32 + 150), 48); 54 | }); 55 | } 56 | 57 | @Override 58 | public void update(double time) { 59 | 60 | } 61 | 62 | @Override 63 | public void input(MouseHandler mouse, KeyHandler key) { 64 | btnEnemy1.input(mouse, key); 65 | btnEnemy2.input(mouse, key); 66 | 67 | if(mouse.getButton() == 1 && !clicked && entityList[selection] != null && !btnEnemy1.getHovering() && !btnEnemy2.getHovering()) { 68 | GameObject go = entityList[selection]; 69 | go.setPos(new Vector2f(mouse.getX() - go.getSize() / 2 + cam.getPos().x + 64, 70 | mouse.getY() - go.getSize() / 2 + cam.getPos().y + 64)); 71 | 72 | if(!ps.getGameObjects().contains(go)) { 73 | count++; 74 | go.setName("enemy: " + Integer.toString(selection) + " count: " + Integer.toString(count)); 75 | ps.getGameObjects().add(go.getBounds().distance(ps.getPlayerPos()), go); 76 | ps.getAABBObjects().insert(go); 77 | } 78 | 79 | clicked = true; 80 | } else if(mouse.getButton() == -1) { 81 | clicked = false; 82 | } 83 | } 84 | 85 | @Override 86 | public void render(Graphics2D g) { 87 | btnEnemy1.render(g); 88 | btnEnemy2.render(g); 89 | } 90 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/states/GameOverState.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.states; 2 | 3 | import com.zerulus.game.util.KeyHandler; 4 | import com.zerulus.game.util.MouseHandler; 5 | import com.zerulus.game.math.Vector2f; 6 | import com.zerulus.game.ui.Button; 7 | import com.zerulus.game.GamePanel; 8 | import com.zerulus.game.graphics.SpriteSheet; 9 | 10 | import java.awt.Font; 11 | import java.awt.Graphics2D; 12 | import java.awt.image.BufferedImage; 13 | 14 | public class GameOverState extends GameState { 15 | 16 | private String gameover = "GAME OVER"; 17 | 18 | private BufferedImage imgButton; 19 | private BufferedImage imgHover; 20 | private Button btnReset; 21 | private Button btnQuit; 22 | private Font font; 23 | 24 | 25 | public GameOverState(GameStateManager gsm) { 26 | super(gsm); 27 | 28 | imgButton = GameStateManager.button.getSubimage(0, 0, 121, 26); 29 | imgHover = GameStateManager.button.getSubimage(0, 29, 122, 28); 30 | 31 | font = new Font("MeatMadness", Font.PLAIN, 48); 32 | btnReset = new Button("RESTART", imgButton, font, new Vector2f(GamePanel.width / 2, GamePanel.height / 2 - 48), 32, 16); 33 | btnQuit = new Button("QUIT", imgButton, font, new Vector2f(GamePanel.width / 2, GamePanel.height / 2 + 48), 32, 16); 34 | 35 | btnReset.addHoverImage(btnReset.createButton("RESTART", imgHover, font, btnReset.getWidth(), btnReset.getHeight(), 32, 20)); 36 | btnQuit.addHoverImage(btnQuit.createButton("QUIT", imgHover, font, btnQuit.getWidth(), btnQuit.getHeight(), 32, 20)); 37 | 38 | btnReset.addEvent(e -> { 39 | gsm.add(GameStateManager.PLAY); 40 | gsm.pop(GameStateManager.GAMEOVER); 41 | }); 42 | 43 | btnQuit.addEvent(e -> { 44 | System.exit(0); 45 | }); 46 | } 47 | 48 | @Override 49 | public void update(double time) { 50 | 51 | } 52 | 53 | @Override 54 | public void input(MouseHandler mouse, KeyHandler key) { 55 | key.escape.tick(); 56 | 57 | btnReset.input(mouse, key); 58 | btnQuit.input(mouse, key); 59 | 60 | if (key.escape.clicked) { 61 | System.exit(0); 62 | } 63 | } 64 | 65 | @Override 66 | public void render(Graphics2D g) { 67 | SpriteSheet.drawArray(g, gameover, new Vector2f(GamePanel.width / 2 - gameover.length() * (32 / 2), GamePanel.height / 2 - 32 / 2), 32, 32, 32); 68 | btnReset.render(g); 69 | btnQuit.render(g); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/states/GameState.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.states; 2 | 3 | import com.zerulus.game.util.KeyHandler; 4 | import com.zerulus.game.util.MouseHandler; 5 | 6 | import java.awt.Graphics2D; 7 | 8 | public abstract class GameState { 9 | 10 | protected GameStateManager gsm; 11 | 12 | public GameState(GameStateManager gsm) { 13 | this.gsm = gsm; 14 | } 15 | 16 | public abstract void update(double time); 17 | public abstract void input(MouseHandler mouse, KeyHandler key); 18 | public abstract void render(Graphics2D g); 19 | } 20 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/states/GameStateManager.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.states; 2 | 3 | import com.zerulus.game.GamePanel; 4 | import com.zerulus.game.util.KeyHandler; 5 | import com.zerulus.game.util.MouseHandler; 6 | import com.zerulus.game.math.Vector2f; 7 | import com.zerulus.game.math.AABB; 8 | import com.zerulus.game.util.Camera; 9 | import com.zerulus.game.graphics.Font; 10 | import com.zerulus.game.graphics.Fontf; 11 | import com.zerulus.game.graphics.SpriteSheet; 12 | 13 | import java.awt.Graphics2D; 14 | 15 | public class GameStateManager { 16 | 17 | private GameState states[]; 18 | 19 | public static Vector2f map; 20 | 21 | public static final int MENU = 0; 22 | public static final int PLAY = 1; 23 | public static final int PAUSE = 2; 24 | public static final int GAMEOVER = 3; 25 | public static final int EDIT = 4; 26 | 27 | public static Font font; 28 | public static Fontf fontf; 29 | public static SpriteSheet ui; 30 | public static SpriteSheet button; 31 | public static Camera cam; 32 | public static Graphics2D g; 33 | 34 | public GameStateManager(Graphics2D g) { 35 | GameStateManager.g = g; 36 | map = new Vector2f(GamePanel.width, GamePanel.height); 37 | Vector2f.setWorldVar(map.x, map.y); 38 | 39 | states = new GameState[5]; 40 | 41 | font = new Font("font/font.png", 10, 10); 42 | fontf = new Fontf(); 43 | fontf.loadFont("font/Stackedpixel.ttf", "MeatMadness"); 44 | fontf.loadFont("font/GravityBold8.ttf", "GravityBold8"); 45 | SpriteSheet.currentFont = font; 46 | 47 | ui = new SpriteSheet("ui/ui.png", 64, 64); 48 | button = new SpriteSheet("ui/buttons.png", 122, 57); 49 | 50 | 51 | cam = new Camera(new AABB(new Vector2f(-64, -64), GamePanel.width + 128, GamePanel.height + 128)); 52 | 53 | states[PLAY] = new PlayState(this, cam); 54 | } 55 | 56 | public boolean isStateActive(int state) { 57 | return states[state] != null; 58 | } 59 | 60 | public GameState getState(int state) { 61 | return states[state]; 62 | } 63 | 64 | public void pop(int state) { 65 | states[state] = null; 66 | } 67 | 68 | public void add(int state) { 69 | if (states[state] != null) 70 | return; 71 | 72 | if (state == PLAY) { 73 | cam = new Camera(new AABB(new Vector2f(0, 0), GamePanel.width + 64, GamePanel.height + 64)); 74 | states[PLAY] = new PlayState(this, cam); 75 | } 76 | else if (state == MENU) { 77 | states[MENU] = new MenuState(this); 78 | } 79 | else if (state == PAUSE) { 80 | states[PAUSE] = new PauseState(this); 81 | } 82 | else if (state == GAMEOVER) { 83 | states[GAMEOVER] = new GameOverState(this); 84 | } 85 | else if (state == EDIT) { 86 | if(states[PLAY] != null) { 87 | states[EDIT] = new EditState(this, cam); 88 | } 89 | } 90 | } 91 | 92 | public void addAndpop(int state) { 93 | addAndpop(state, 0); 94 | } 95 | 96 | public void addAndpop(int state, int remove) { 97 | pop(state); 98 | add(state); 99 | } 100 | 101 | public void update(double time) { 102 | for (int i = 0; i < states.length; i++) { 103 | if (states[i] != null) { 104 | states[i].update(time); 105 | } 106 | } 107 | } 108 | 109 | public void input(MouseHandler mouse, KeyHandler key) { 110 | 111 | for (int i = 0; i < states.length; i++) { 112 | if (states[i] != null) { 113 | states[i].input(mouse, key); 114 | } 115 | } 116 | } 117 | 118 | public void render(Graphics2D g) { 119 | g.setFont(GameStateManager.fontf.getFont("MeatMadness")); 120 | for (int i = 0; i < states.length; i++) { 121 | if (states[i] != null) { 122 | states[i].render(g); 123 | } 124 | } 125 | } 126 | 127 | } 128 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/states/MenuState.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.states; 2 | 3 | import com.zerulus.game.util.KeyHandler; 4 | import com.zerulus.game.util.MouseHandler; 5 | 6 | import java.awt.Graphics2D; 7 | 8 | public class MenuState extends GameState { 9 | 10 | public MenuState(GameStateManager gsm) { 11 | super(gsm); 12 | } 13 | 14 | @Override 15 | public void update(double time) { 16 | 17 | } 18 | 19 | @Override 20 | public void input(MouseHandler mouse, KeyHandler key) { 21 | 22 | } 23 | 24 | @Override 25 | public void render(Graphics2D g) { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/states/PauseState.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.states; 2 | 3 | import java.awt.Font; 4 | import java.awt.Graphics2D; 5 | import java.awt.image.BufferedImage; 6 | 7 | import com.zerulus.game.util.MouseHandler; 8 | import com.zerulus.game.util.KeyHandler; 9 | import com.zerulus.game.math.Vector2f; 10 | import com.zerulus.game.ui.Button; 11 | import com.zerulus.game.GamePanel; 12 | 13 | public class PauseState extends GameState { 14 | 15 | private Button btnResume; 16 | private Button btnExit; 17 | private Font font; 18 | 19 | public PauseState(GameStateManager gsm) { 20 | super(gsm); 21 | 22 | BufferedImage imgButton = GameStateManager.button.getSubimage(0, 0, 121, 26); 23 | BufferedImage imgHover = GameStateManager.button.getSubimage(0, 29, 122, 28); 24 | 25 | font = new Font("MeatMadness", Font.PLAIN, 48); 26 | btnResume = new Button("RESUME", imgButton, font, new Vector2f(GamePanel.width / 2, GamePanel.height / 2 - 48), 32, 16); 27 | btnExit = new Button("EXIT", imgButton, font, new Vector2f(GamePanel.width / 2, GamePanel.height / 2 + 48), 32, 16); 28 | 29 | btnResume.addHoverImage(btnResume.createButton("RESUME", imgHover, font, btnResume.getWidth(), btnResume.getHeight(), 32, 20)); 30 | btnExit.addHoverImage(btnExit.createButton("EXIT", imgHover, font, btnExit.getWidth(), btnExit.getHeight(), 32, 20)); 31 | 32 | btnResume.addEvent(e -> { 33 | gsm.pop(GameStateManager.PAUSE); 34 | }); 35 | 36 | btnExit.addEvent(e -> { 37 | System.exit(0); 38 | }); 39 | } 40 | 41 | @Override 42 | public void update(double time) { 43 | 44 | } 45 | 46 | @Override 47 | public void input(MouseHandler mouse, KeyHandler key) { 48 | btnResume.input(mouse, key); 49 | btnExit.input(mouse, key); 50 | 51 | } 52 | 53 | @Override 54 | public void render(Graphics2D g) { 55 | btnResume.render(g); 56 | btnExit.render(g); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/states/PlayState.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.states; 2 | 3 | import com.zerulus.game.GamePanel; 4 | import com.zerulus.game.entity.Enemy; 5 | import com.zerulus.game.entity.Player; 6 | import com.zerulus.game.entity.material.Material; 7 | import com.zerulus.game.entity.material.MaterialManager; 8 | import com.zerulus.game.graphics.SpriteSheet; 9 | import com.zerulus.game.math.Vector2f; 10 | import com.zerulus.game.tiles.TileManager; 11 | 12 | import com.zerulus.game.util.KeyHandler; 13 | import com.zerulus.game.util.MouseHandler; 14 | import com.zerulus.game.util.Camera; 15 | import com.zerulus.game.util.GameObjectHeap; 16 | import com.zerulus.game.util.AABBTree; 17 | 18 | import com.zerulus.game.ui.PlayerUI; 19 | 20 | import java.awt.Color; 21 | import java.awt.Graphics2D; 22 | 23 | public class PlayState extends GameState { 24 | 25 | public Player player; 26 | private GameObjectHeap gameObject; 27 | private AABBTree aabbTree; 28 | private TileManager tm; 29 | private MaterialManager mm; 30 | private Camera cam; 31 | private PlayerUI pui; 32 | 33 | public static Vector2f map; 34 | private double heaptime; 35 | 36 | public PlayState(GameStateManager gsm, Camera cam) { 37 | super(gsm); 38 | 39 | map = new Vector2f(); 40 | Vector2f.setWorldVar(map.x, map.y); 41 | this.cam = cam; 42 | 43 | tm = new TileManager("tile/tilemap.xml", cam); 44 | 45 | /*SpriteSheet tileset = new SpriteSheet("tile/overworldOP.png", 32, 32); 46 | SpriteSheet treeset = new SpriteSheet("material/trees.png", 64, 96); 47 | 48 | mm = new MaterialManager(64, 150); 49 | mm.setMaterial(MaterialManager.TYPE.TREE, treeset.getSprite(1, 0), 64); 50 | mm.setMaterial(MaterialManager.TYPE.TREE, treeset.getSprite(3, 0), 64); 51 | 52 | tm = new TileManager(tileset, 150, cam, mm);*/ 53 | 54 | gameObject = new GameObjectHeap(); 55 | //gameObject.addAll(mm.list); 56 | aabbTree = new AABBTree(); 57 | 58 | player = new Player(cam, new SpriteSheet("entity/wizardPlayer.png", 64, 64), new Vector2f(0 + (GamePanel.width / 2) - 32, 0 + (GamePanel.height / 2) - 32), 64, tm); 59 | pui = new PlayerUI(player); 60 | aabbTree.insert(player); 61 | 62 | cam.target(player); 63 | 64 | } 65 | 66 | public GameObjectHeap getGameObjects() { return gameObject; } 67 | public AABBTree getAABBObjects() { return aabbTree; } 68 | public Vector2f getPlayerPos() { return player.getPos(); } 69 | 70 | private boolean canBuildHeap(int offset, int si, double time) { 71 | 72 | if(gameObject.size() > 3 && (heaptime / si) + offset < (time / si)) { 73 | return true; 74 | } 75 | 76 | return false; 77 | } 78 | 79 | public void update(double time) { 80 | Vector2f.setWorldVar(map.x, map.y); 81 | 82 | if(!gsm.isStateActive(GameStateManager.PAUSE)) { 83 | if(!gsm.isStateActive(GameStateManager.EDIT)) { 84 | 85 | 86 | //aabbTree.update(player); 87 | 88 | if(player.getDeath()) { 89 | gsm.add(GameStateManager.GAMEOVER); 90 | gsm.pop(GameStateManager.PLAY); 91 | } 92 | 93 | for(int i = 0; i < gameObject.size(); i++) { 94 | if(gameObject.get(i).go instanceof Enemy) { 95 | Enemy enemy = ((Enemy) gameObject.get(i).go); 96 | if(player.getHitBounds().collides(enemy.getBounds())) { 97 | player.setTargetEnemy(enemy); 98 | } 99 | 100 | if(enemy.getDeath()) { 101 | gameObject.remove(enemy); 102 | } else { 103 | enemy.update(player, time); 104 | } 105 | 106 | if(canBuildHeap(2500, 1000000, time)) { 107 | gameObject.get(i).value = enemy.getBounds().distance(player.getPos()); 108 | } 109 | 110 | continue; 111 | } 112 | 113 | if(gameObject.get(i).go instanceof Material) { 114 | Material mat = ((Material) gameObject.get(i).go); 115 | if(player.getHitBounds().collides(mat.getBounds())) { 116 | player.setTargetGameObject(mat); 117 | } 118 | } 119 | } 120 | 121 | if(canBuildHeap(3, 1000000000, time)) { 122 | heaptime = System.nanoTime(); 123 | gameObject.buildHeap(); 124 | //System.out.println(gameObject); 125 | } 126 | 127 | player.update(time); 128 | pui.update(time); 129 | } 130 | cam.update(); 131 | } 132 | } 133 | 134 | public void input(MouseHandler mouse, KeyHandler key) { 135 | key.escape.tick(); 136 | key.f1.tick(); 137 | key.enter.tick(); 138 | 139 | if(!gsm.isStateActive(GameStateManager.PAUSE)) { 140 | if(cam.getTarget() == player) { 141 | player.input(mouse, key); 142 | } 143 | cam.input(mouse, key); 144 | 145 | if(key.f1.clicked) { 146 | if(gsm.isStateActive(GameStateManager.EDIT)) { 147 | gsm.pop(GameStateManager.EDIT); 148 | cam.target(player); 149 | } else { 150 | gsm.add(GameStateManager.EDIT); 151 | cam.target(null); 152 | } 153 | } 154 | 155 | if(key.enter.clicked) { 156 | System.out.println(aabbTree.toString()); 157 | System.out.println(gameObject.toString()); 158 | } 159 | 160 | pui.input(mouse, key); 161 | } else if(gsm.isStateActive(GameStateManager.EDIT)) { 162 | gsm.pop(GameStateManager.EDIT); 163 | cam.target(player); 164 | } 165 | 166 | if (key.escape.clicked) { 167 | if(gsm.isStateActive(GameStateManager.PAUSE)) { 168 | gsm.pop(GameStateManager.PAUSE); 169 | } else { 170 | gsm.add(GameStateManager.PAUSE); 171 | } 172 | } 173 | } 174 | 175 | public void render(Graphics2D g) { 176 | tm.render(g); 177 | 178 | player.render(g); 179 | for(int i = 0; i < gameObject.size(); i++) { 180 | if(cam.getBounds().collides(gameObject.get(i).getBounds())) { 181 | gameObject.get(i).go.render(g); 182 | } 183 | } 184 | 185 | g.setColor(Color.white); 186 | 187 | String fps = GamePanel.oldFrameCount + " FPS"; 188 | g.drawString(fps, GamePanel.width - 6 * 32, 32); 189 | 190 | String tps = GamePanel.oldTickCount + " TPS"; 191 | g.drawString(tps, GamePanel.width - 6 * 32, 64); 192 | 193 | pui.render(g); 194 | 195 | cam.render(g); 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/states/levels/Save.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.states.levels; 2 | 3 | import java.io.File; 4 | 5 | import javax.xml.parsers.DocumentBuilder; 6 | import javax.xml.parsers.DocumentBuilderFactory; 7 | import javax.xml.transform.Transformer; 8 | import javax.xml.transform.TransformerFactory; 9 | import javax.xml.transform.dom.DOMSource; 10 | import javax.xml.transform.stream.StreamResult; 11 | 12 | import com.zerulus.game.tiles.TileManager; 13 | 14 | import org.w3c.dom.Attr; 15 | import org.w3c.dom.Document; 16 | import org.w3c.dom.Element; 17 | 18 | public class Save { 19 | 20 | public Save(TileManager tm) { 21 | System.out.println("Saving map..."); 22 | saveMap(tm); 23 | 24 | } 25 | 26 | private void saveMap(TileManager tm) { 27 | try { 28 | 29 | DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); 30 | DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); 31 | 32 | Document doc = docBuilder.newDocument(); 33 | Element rootElement = doc.createElement("map"); 34 | 35 | Attr width = doc.createAttribute("width"); 36 | width.setValue(Integer.toString(tm.getChunkSize())); 37 | rootElement.setAttributeNode(width); 38 | 39 | Attr height = doc.createAttribute("height"); 40 | height.setValue(Integer.toString(tm.getChunkSize())); 41 | rootElement.setAttributeNode(height); 42 | 43 | Attr tilewidth = doc.createAttribute("tilewidth"); 44 | tilewidth.setValue(Integer.toString(tm.getBlockWidth())); 45 | rootElement.setAttributeNode(tilewidth); 46 | 47 | Attr tileheight = doc.createAttribute("tileheight"); 48 | tileheight.setValue(Integer.toString(tm.getBlockHeight())); 49 | rootElement.setAttributeNode(tileheight); 50 | 51 | doc.appendChild(rootElement); 52 | 53 | Element tileset = doc.createElement("tileset"); 54 | Attr name = doc.createAttribute("name"); 55 | name.setValue(tm.getFilename()); 56 | tileset.setAttributeNode(name); 57 | 58 | Attr columns = doc.createAttribute("columns"); 59 | columns.setValue(Integer.toString(tm.getColumns())); 60 | tileset.setAttributeNode(columns); 61 | tileset.setAttributeNode(tilewidth); 62 | tileset.setAttributeNode(tileheight); 63 | 64 | rootElement.appendChild(tileset); 65 | 66 | // create function for layers? 67 | 68 | Element solid = doc.createElement("data"); 69 | Attr nameSolid = doc.createAttribute("name"); 70 | nameSolid.setValue("Solid"); 71 | solid.setAttributeNode(nameSolid); 72 | solid.setAttributeNode(width); 73 | solid.setAttributeNode(height); 74 | 75 | Element data = doc.createElement("data"); 76 | data.appendChild(doc.createTextNode(tm.getSolid())); 77 | solid.appendChild(data); 78 | 79 | rootElement.appendChild(solid); 80 | 81 | Element layer1 = doc.createElement("data"); 82 | Attr nameLayer1 = doc.createAttribute("name"); 83 | nameLayer1.setValue("Layer1"); 84 | layer1.setAttributeNode(nameLayer1); 85 | layer1.setAttributeNode(width); 86 | layer1.setAttributeNode(height); 87 | 88 | Element data1 = doc.createElement("data"); 89 | data1.appendChild(doc.createTextNode(tm.getGenMap())); 90 | layer1.appendChild(data1); 91 | 92 | rootElement.appendChild(layer1); 93 | 94 | TransformerFactory transformerFactory = TransformerFactory.newInstance(); 95 | Transformer transformer = transformerFactory.newTransformer(); 96 | DOMSource source = new DOMSource(doc); 97 | StreamResult result = new StreamResult(new File("C:\\file.xml")); 98 | 99 | transformer.transform(source, result); 100 | System.out.println("Map saved!"); 101 | 102 | } catch (Exception e) { 103 | e.printStackTrace(); 104 | } 105 | } 106 | 107 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/tiles/TileManager.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.tiles; 2 | 3 | import com.zerulus.game.entity.material.MaterialManager; 4 | import com.zerulus.game.graphics.SpriteSheet; 5 | import com.zerulus.game.tiles.blocks.NormBlock; 6 | import com.zerulus.game.util.Camera; 7 | 8 | import java.awt.Graphics2D; 9 | import java.util.ArrayList; 10 | import java.io.File; 11 | 12 | import org.w3c.dom.Document; 13 | import org.w3c.dom.Element; 14 | import org.w3c.dom.Node; 15 | import org.w3c.dom.NodeList; 16 | 17 | import javax.xml.parsers.DocumentBuilder; 18 | import javax.xml.parsers.DocumentBuilderFactory; 19 | 20 | public class TileManager { 21 | 22 | public static ArrayList tm; 23 | public Camera cam; 24 | private SpriteSheet spritesheet; 25 | private int blockWidth; 26 | private int blockHeight; 27 | private MaterialManager mm; 28 | private int width; 29 | private int height; 30 | 31 | private String genMap; 32 | private String solid; 33 | private int chuckSize; 34 | private String file; 35 | private int columns; 36 | 37 | public TileManager() { 38 | tm = new ArrayList(); 39 | } 40 | 41 | public TileManager(String path, Camera cam) { 42 | this(); 43 | addTileMap(path, 64, 64, cam); 44 | } 45 | 46 | public TileManager(String path, int blockWidth, int blockHeight, Camera cam) { 47 | this(); 48 | addTileMap(path, blockWidth, blockHeight, cam); 49 | } 50 | 51 | public TileManager(SpriteSheet spritesheet, int chuckSize, Camera cam, MaterialManager mm) { 52 | this(); 53 | addTileMap(spritesheet, 64, 64, chuckSize, cam, mm); 54 | 55 | } 56 | 57 | public TileManager(SpriteSheet spritesheet, int blockWidth, int blockHeight, int chuckSize, Camera cam, MaterialManager mm) { 58 | this(); 59 | addTileMap(spritesheet, blockWidth, blockHeight, chuckSize, cam, mm); 60 | System.gc(); 61 | } 62 | 63 | public String getGenMap() { return genMap; } 64 | public String getSolid() { return solid; } 65 | public int getChunkSize() { return chuckSize; } 66 | public int getBlockWidth() { return blockWidth; } 67 | public int getBlockHeight() { return blockHeight; } 68 | public String getFilename() { return file; } 69 | public int getColumns() { return columns; } 70 | 71 | public void generateTileMap(int chuckSize) { 72 | addTileMap(spritesheet, blockWidth, blockHeight, chuckSize, cam, mm); 73 | } 74 | 75 | 76 | private void addTileMap(SpriteSheet spritesheet, int blockWidth, int blockHeight, int chuckSize, Camera cam, MaterialManager mm) { 77 | this.cam = cam; 78 | this.mm = mm; 79 | this.spritesheet = spritesheet; 80 | this.blockWidth = blockWidth; 81 | this.blockHeight = blockHeight; 82 | this.width = chuckSize; 83 | this.height = chuckSize; 84 | this.file = spritesheet.getFilename(); 85 | this.columns = spritesheet.getCols(); 86 | 87 | cam.setTileSize(blockWidth); 88 | String[] data = new String[3]; 89 | TileMapGenerator tmg = new TileMapGenerator(chuckSize, blockWidth, mm); 90 | 91 | // For now 92 | data[0] = ""; 93 | 94 | for(int i = 0; i < chuckSize; i++){ 95 | for(int j = 0; j < chuckSize; j++){ 96 | data[0] += "0,"; 97 | } 98 | } 99 | 100 | tm.add(new TileMapObj(data[0], spritesheet, chuckSize, chuckSize, blockWidth, blockHeight, spritesheet.getCols())); 101 | 102 | tm.add(new TileMapNorm(tmg.base, spritesheet, chuckSize, chuckSize, blockWidth, blockHeight, spritesheet.getCols())); 103 | //tm.add(new TileMapNorm(tmg.onTop, spritesheet, chuckSize, chuckSize, blockWidth, blockHeight, spritesheet.getCols())); 104 | 105 | cam.setLimit(chuckSize * blockWidth, chuckSize * blockHeight); 106 | 107 | this.solid = data[0]; 108 | this.genMap = tmg.base; 109 | } 110 | 111 | private void addTileMap(String path, int blockWidth, int blockHeight, Camera cam) { 112 | this.cam = cam; 113 | cam.setTileSize(blockWidth); 114 | String imagePath; 115 | 116 | int width = 0; 117 | int height = 0; 118 | int tileWidth; 119 | int tileHeight; 120 | int tileColumns; 121 | int layers = 0; 122 | SpriteSheet sprite; 123 | 124 | String[] data = new String[10]; 125 | 126 | try { 127 | DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); 128 | DocumentBuilder builder = builderFactory.newDocumentBuilder(); 129 | Document doc = builder.parse(new File(getClass().getClassLoader().getResource(path).toURI())); 130 | doc.getDocumentElement().normalize(); 131 | 132 | NodeList list = doc.getElementsByTagName("tileset"); 133 | Node node = list.item(0); 134 | Element eElement = (Element) node; 135 | 136 | imagePath = eElement.getAttribute("name"); 137 | tileWidth = Integer.parseInt(eElement.getAttribute("tilewidth")); 138 | tileHeight = Integer.parseInt(eElement.getAttribute("tileheight")); 139 | tileColumns = Integer.parseInt(eElement.getAttribute("columns")); 140 | 141 | this.columns = tileColumns; 142 | this.file = imagePath; 143 | sprite = new SpriteSheet("tile/" + imagePath + ".png", tileWidth, tileHeight); 144 | 145 | list = doc.getElementsByTagName("layer"); 146 | layers = list.getLength(); 147 | 148 | for(int i = 0; i < layers; i++) { 149 | node = list.item(i); 150 | eElement = (Element) node; 151 | if(i <= 0) { 152 | width = Integer.parseInt(eElement.getAttribute("width")); 153 | height = Integer.parseInt(eElement.getAttribute("height")); 154 | } 155 | 156 | data[i] = eElement.getElementsByTagName("data").item(0).getTextContent(); 157 | 158 | if(i >= 1) { 159 | tm.add(new TileMapNorm(data[i], sprite, width, height, blockWidth, blockHeight, tileColumns)); 160 | } else { 161 | tm.add(new TileMapObj(data[i], sprite, width, height, blockWidth, blockHeight, tileColumns)); 162 | } 163 | } 164 | 165 | cam.setLimit(width * blockWidth, height * blockHeight); 166 | } catch(Exception e) { 167 | System.out.println("ERROR - TILEMANAGER: can not read tilemap:"); 168 | e.printStackTrace(); 169 | System.exit(0); 170 | } 171 | 172 | this.width = width; 173 | this.height = height; 174 | } 175 | 176 | public NormBlock[] getNormalTile(int id) { 177 | int normMap = 1; 178 | if(tm.size() < 2) normMap = 0; 179 | NormBlock[] block = new NormBlock[9]; 180 | 181 | int i = 0; 182 | for(int x = 1; x > -2; x--) { 183 | for(int y = 1; y > -2; y--) { 184 | if(id + (y + x * height) < 0 || id + (y + x * height) > (width * height) - 2) continue; 185 | block[i] = (NormBlock) tm.get(normMap).getBlocks()[id + (y + x * height)]; 186 | i++; 187 | } 188 | } 189 | 190 | return block; 191 | } 192 | 193 | public void render(Graphics2D g) { 194 | if(cam == null) 195 | return; 196 | 197 | for(int i = 0; i < tm.size(); i++) { 198 | tm.get(i).render(g, cam.getBounds()); 199 | } 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/tiles/TileMap.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.tiles; 2 | 3 | import com.zerulus.game.math.AABB; 4 | import com.zerulus.game.tiles.blocks.Block; 5 | 6 | import java.awt.Graphics2D; 7 | 8 | public abstract class TileMap { 9 | 10 | public abstract Block[] getBlocks(); 11 | public abstract void render(Graphics2D g, AABB cam); 12 | } 13 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/tiles/TileMapGenerator.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.tiles; 2 | 3 | import com.zerulus.game.noise.SimplexNoise; 4 | import com.zerulus.game.entity.material.MaterialManager; 5 | 6 | public class TileMapGenerator { 7 | 8 | public String base; 9 | private int[] data; 10 | 11 | public String onTop; 12 | private int[] layer; 13 | 14 | private int chuckSize; 15 | 16 | private MaterialManager mm; 17 | 18 | // could set this as enum however that seems a little too much. 19 | // could have a class with all the different types of tiles but that also seems a little too much. 20 | // could change tileset and would have to change the numbers anyways. 21 | // the best way would probably create a program that labels tiles with a mouse click, 22 | // however that's over kill. 23 | 24 | private int[] grass = {52, 53, 54}; 25 | private int[] dirt = {46, 47, 48}; 26 | 27 | private Tile[] tiles = { new Tile(0.6f, 35, grass), new Tile(1f, 29, dirt) }; // change this later? 28 | 29 | public TileMapGenerator(int chuckSize, int tileSize, MaterialManager mm) { 30 | this.mm = mm; 31 | this.chuckSize = chuckSize; 32 | this.layer = new int[chuckSize * chuckSize]; 33 | this.base = ""; 34 | this.onTop = ""; 35 | 36 | int xStart = 0; 37 | int xEnd = 500; 38 | int yStart = 0; 39 | int yEnd = 500; 40 | 41 | this.data = simplexTiles(xStart, xEnd, yStart, yEnd); 42 | //beautifyTiles(); 43 | 44 | for(int i = 0; i < chuckSize * chuckSize; i++) { 45 | onTop += layer[i] + ","; 46 | base += data[i] + ","; 47 | } 48 | } 49 | 50 | // O(m*9n^2) -> O(m*n^2) -> O(n^2) 51 | /* private void beautifyTiles() { 52 | String result = ""; 53 | 54 | for(int i = 0; i < chuckSize; i++) { 55 | for(int j = 0; j < chuckSize; j++) { 56 | int temp = data[j + i * chuckSize]; 57 | if(temp != 29) continue; 58 | 59 | for(int x = 1; x > -2; x--) { 60 | for(int y = 1; y > -2; y--) { 61 | if(x == 0 && y == 0) continue; 62 | 63 | int c = ((j + y) + (i + x) * chuckSize); 64 | if(c > 0 && c < data.length && data[c] == 35) { 65 | layer[c] = x + 26 + ((y + 1) * 9); 66 | //data[c] = 29; 67 | } else { 68 | break; 69 | } 70 | } 71 | } 72 | } 73 | } 74 | } */ 75 | 76 | private int[] simplexTiles(int xStart, int xEnd, int yStart, int yEnd) { 77 | int[] data = new int[chuckSize * chuckSize]; 78 | SimplexNoise simplexNoise = new SimplexNoise(300, 0.4, 5000); 79 | double[][] result = new double[chuckSize][chuckSize]; 80 | 81 | for(int i = 0; i < chuckSize; i++){ 82 | for(int j = 0; j < chuckSize; j++){ 83 | int x = (int) (xStart + i * ((xEnd - xStart) / chuckSize)); 84 | int y = (int) (yStart + j * ((yEnd - yStart) / chuckSize)); 85 | result[i][j] = 0.5 * (1 + simplexNoise.getNoise(x, y)); 86 | 87 | for(int k = 0; k < tiles.length; k++) { 88 | if(result[i][j] < tiles[k].rarity) { 89 | if(k == 0 && result[i][j] < Math.random() * 0.52) { 90 | mm.add(MaterialManager.TYPE.TREE, j + i * chuckSize); 91 | } 92 | data[j + i * chuckSize] = tiles[k].generate(); 93 | break; 94 | } 95 | } 96 | } 97 | } 98 | 99 | return data; 100 | } 101 | } 102 | 103 | 104 | 105 | class Tile { 106 | public float rarity; 107 | public int spriteIndex; 108 | public int[] vary; 109 | // public can generate materials? 110 | // public max materials? 111 | // public number of materials? 112 | 113 | public Tile(float rarity, int spriteIndex) { 114 | this.rarity = rarity; 115 | this.spriteIndex = spriteIndex; 116 | 117 | // check if materials can be generated 118 | // random number of materials based on max amount 119 | } 120 | 121 | public Tile(float rarity, int spriteIndex, int[] vary) { 122 | this.rarity = rarity; 123 | this.spriteIndex = spriteIndex; 124 | this.vary = vary; 125 | 126 | // check if materials can be generated 127 | // random number of materials based on max amount 128 | } 129 | 130 | public int generate() { 131 | double random = Math.random(); 132 | if(vary != null && random > 0.9) { 133 | return vary[((int) (random * 100)) % (vary.length )]; 134 | } 135 | 136 | return spriteIndex; 137 | } 138 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/tiles/TileMapNorm.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.tiles; 2 | 3 | import java.awt.Graphics2D; 4 | 5 | import com.zerulus.game.graphics.SpriteSheet; 6 | import com.zerulus.game.math.AABB; 7 | import com.zerulus.game.math.Vector2f; 8 | import com.zerulus.game.tiles.blocks.Block; 9 | import com.zerulus.game.tiles.blocks.NormBlock; 10 | 11 | public class TileMapNorm extends TileMap { 12 | 13 | public Block[] blocks; 14 | 15 | private int tileWidth; 16 | private int tileHeight; 17 | 18 | private int height; 19 | 20 | public TileMapNorm(String data, SpriteSheet sprite, int width, int height, int tileWidth, int tileHeight, int tileColumns) { 21 | blocks = new Block[width * height]; 22 | 23 | this.tileWidth = tileWidth; 24 | this.tileHeight = tileHeight; 25 | 26 | this.height = height; 27 | 28 | String[] block = data.split(","); 29 | 30 | for(int i = 0; i < (width * height); i++) { 31 | int temp = Integer.parseInt(block[i].replaceAll("\\s+","")); 32 | if(temp != 0) { 33 | blocks[i] = new NormBlock(sprite.getNewSprite((int) ((temp - 1) % tileColumns), (int) ((temp - 1) / tileColumns) ), new Vector2f((int) (i % width) * tileWidth, (int) (i / height) * tileHeight), tileWidth, tileHeight); 34 | //blocks[i].setMaterial(0); 35 | } 36 | } 37 | } 38 | 39 | public Block[] getBlocks() { return blocks; } 40 | 41 | public void render(Graphics2D g, AABB cam) { 42 | int x = (int) ((cam.getPos().x) / tileWidth); 43 | int y = (int) ((cam.getPos().y) / tileHeight); 44 | 45 | for(int i = x; i < x + (cam.getWidth() / tileWidth); i++) { 46 | for(int j = y; j < y + (cam.getHeight() / tileHeight); j++) { 47 | if(i + (j * height) > -1 && i + (j * height) < blocks.length && blocks[i + (j * height)] != null) { 48 | blocks[i + (j * height)].render(g); 49 | } 50 | } 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/tiles/TileMapObj.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.tiles; 2 | 3 | import java.awt.Graphics2D; 4 | 5 | import com.zerulus.game.graphics.SpriteSheet; 6 | import com.zerulus.game.math.AABB; 7 | import com.zerulus.game.math.Vector2f; 8 | import com.zerulus.game.tiles.blocks.Block; 9 | import com.zerulus.game.tiles.blocks.HoleBlock; 10 | import com.zerulus.game.tiles.blocks.ObjBlock; 11 | 12 | public class TileMapObj extends TileMap { 13 | 14 | public static Block[] event_blocks; 15 | 16 | private int tileWidth; 17 | private int tileHeight; 18 | 19 | public static int width; 20 | public static int height; 21 | 22 | public TileMapObj(String data, SpriteSheet sprite, int width, int height, int tileWidth, int tileHeight, int tileColumns) { 23 | Block tempBlock; 24 | event_blocks = new Block[width * height]; 25 | 26 | this.tileWidth = tileWidth; 27 | this.tileHeight = tileHeight; 28 | 29 | TileMapObj.width = width; 30 | TileMapObj.height = height; 31 | 32 | String[] block = data.split(","); 33 | for(int i = 0; i < (width * height); i++) { 34 | int temp = Integer.parseInt(block[i].replaceAll("\\s+","")); 35 | if(temp != 0) { 36 | if(temp == 172) { 37 | // TODO: find edge and connect them to form one polygon 38 | tempBlock = new HoleBlock(sprite.getSprite((int) ((temp - 1) % tileColumns), (int) ((temp - 1) / tileColumns) ), new Vector2f((int) (i % width) * tileWidth, (int) (i / height) * tileHeight), tileWidth, tileHeight); 39 | } else { 40 | tempBlock = new ObjBlock(sprite.getSprite((int) ((temp - 1) % tileColumns), (int) ((temp - 1) / tileColumns) ), new Vector2f((int) (i % width) * tileWidth, (int) (i / height) * tileHeight), tileWidth, tileHeight); 41 | } 42 | event_blocks[i] = tempBlock; 43 | } 44 | } 45 | } 46 | 47 | public Block[] getBlocks() { return event_blocks; } 48 | 49 | public void render(Graphics2D g, AABB cam) { 50 | int x = (int) ((cam.getPos().x) / tileWidth); 51 | int y = (int) ((cam.getPos().y) / tileHeight); 52 | 53 | for(int i = x; i < x + (cam.getWidth() / tileWidth); i++) { 54 | for(int j = y; j < y + (cam.getHeight() / tileHeight); j++) { 55 | if(i + (j * height) > -1 && i + (j * height) < event_blocks.length && event_blocks[i + (j * height)] != null) 56 | event_blocks[i + (j * height)].render(g); 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/tiles/blocks/Block.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.tiles.blocks; 2 | 3 | import java.awt.Graphics2D; 4 | 5 | import com.zerulus.game.graphics.Sprite; 6 | import com.zerulus.game.math.Vector2f; 7 | import com.zerulus.game.math.AABB; 8 | 9 | public abstract class Block { 10 | protected int w; 11 | protected int h; 12 | 13 | public Sprite img; 14 | public Vector2f pos; 15 | 16 | public Block(Sprite img, Vector2f pos, int w, int h) { 17 | this.img = img; 18 | this.pos = pos; 19 | this.w = w; 20 | this.h = h; 21 | } 22 | 23 | public int getWidth() { return w; } 24 | public int getHeight() { return h; } 25 | 26 | public abstract boolean update(AABB p); 27 | public abstract boolean isInside(AABB p); 28 | 29 | public abstract Sprite getImage(); 30 | public Vector2f getPos() { return pos; } 31 | 32 | public void render(Graphics2D g) { 33 | g.drawImage(img.image, (int) pos.getWorldVar().x, (int) pos.getWorldVar().y, w, h, null); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/tiles/blocks/HoleBlock.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.tiles.blocks; 2 | 3 | import java.awt.Graphics2D; 4 | 5 | import com.zerulus.game.graphics.Sprite; 6 | import com.zerulus.game.math.Vector2f; 7 | import com.zerulus.game.math.AABB; 8 | 9 | public class HoleBlock extends Block { 10 | 11 | public HoleBlock(Sprite img, Vector2f pos, int w, int h) { 12 | super(img, pos, w, h); 13 | } 14 | 15 | public boolean update(AABB p) { 16 | return false; 17 | } 18 | 19 | public Sprite getImage() { 20 | return img; 21 | } 22 | 23 | public boolean isInside(AABB p) { 24 | 25 | if(p.getPos().x + p.getXOffset() < pos.x) return false; 26 | if(p.getPos().y + p.getYOffset() < pos.y) return false; 27 | if(w + pos.x < p.getWidth() + (p.getPos().x + p.getXOffset())) return false; 28 | if(h + pos.y < p.getHeight() + (p.getPos().y + p.getYOffset())) return false; 29 | 30 | return true; 31 | } 32 | 33 | public void render(Graphics2D g){ 34 | super.render(g); 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/tiles/blocks/NormBlock.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.tiles.blocks; 2 | 3 | import java.awt.Graphics2D; 4 | 5 | import com.zerulus.game.graphics.Sprite; 6 | import com.zerulus.game.math.Vector2f; 7 | import com.zerulus.game.math.AABB; 8 | 9 | public class NormBlock extends Block { 10 | 11 | public NormBlock(Sprite img, Vector2f pos, int w, int h) { 12 | super(img, pos, w, h); 13 | 14 | img.setEffect(Sprite.effect.DECAY); 15 | } 16 | 17 | public boolean update(AABB p) { 18 | return false; 19 | } 20 | 21 | public Sprite getImage() { return img; } 22 | 23 | public boolean isInside(AABB p) { 24 | return false; 25 | } 26 | 27 | public void render(Graphics2D g){ 28 | super.render(g); 29 | } 30 | 31 | public String toString() { 32 | return "position: " + pos; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/tiles/blocks/ObjBlock.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.tiles.blocks; 2 | 3 | import java.awt.Graphics2D; 4 | 5 | 6 | import com.zerulus.game.graphics.Sprite; 7 | import com.zerulus.game.math.Vector2f; 8 | import com.zerulus.game.math.AABB; 9 | 10 | public class ObjBlock extends Block { 11 | 12 | public ObjBlock(Sprite img, Vector2f pos, int w, int h) { 13 | super(img, pos, w, h); 14 | } 15 | 16 | public boolean update(AABB p) { 17 | return true; 18 | } 19 | 20 | public Sprite getImage() { 21 | return img; 22 | } 23 | 24 | public boolean isInside(AABB p) { 25 | return false; 26 | } 27 | 28 | public void render(Graphics2D g){ 29 | super.render(g); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/ui/BuildOptionUI.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.ui; 2 | 3 | import com.zerulus.game.GamePanel; 4 | import com.zerulus.game.graphics.SpriteSheet; 5 | import com.zerulus.game.math.Vector2f; 6 | import com.zerulus.game.states.GameStateManager; 7 | 8 | import java.awt.image.BufferedImage; 9 | 10 | public class BuildOptionUI { 11 | 12 | private SpriteSheet icons; 13 | 14 | private BufferedImage imgButton; 15 | private BufferedImage imgPressed; 16 | 17 | private Slots[] parentSlots; 18 | 19 | public BuildOptionUI() { 20 | this.icons = new SpriteSheet("ui/icons.png", 32, 32); 21 | 22 | this.imgButton = GameStateManager.button.getSubimage(0, 137, 40, 40); 23 | this.imgPressed = GameStateManager.button.getSubimage(41, 137, 40, 40); 24 | 25 | this.parentSlots = createBuildingUI(); 26 | } 27 | 28 | public Slots[] getSlots() { 29 | return parentSlots; 30 | } 31 | 32 | 33 | private Slots[] createGather(int size, int x, int y, BufferedImage[] slotsHori) { 34 | Button[] btnOptions = new Button[2]; 35 | for(int i = 0; i < btnOptions.length; i++) { 36 | btnOptions[i] = new Button(icons.getSprite(i, 1).image, imgButton, new Vector2f(x - (size + 10) * (i + 1), y), size, size, 8); 37 | btnOptions[i].addPressedImage(imgPressed); 38 | } 39 | 40 | Vector2f[][] optionsPos = new Vector2f[btnOptions.length][slotsHori.length]; 41 | 42 | int img = 0; 43 | for(int i = 0; i < btnOptions.length; i++) { 44 | for(int j = 0; j < optionsPos[0].length; j++) { 45 | img = (i == btnOptions.length - 1 && j == btnOptions.length - 1) ? 0 : 1; 46 | optionsPos[i][j] = new Vector2f( 47 | x - ((size + 10) * (i + 1)) + ((size + 12) * ((j + 1) % 2)) - slotsHori[img].getWidth(), 48 | y + ((size + 8) - slotsHori[img].getHeight()) / 2); 49 | } 50 | } 51 | 52 | Slots[] optionslots = new Slots[btnOptions.length]; 53 | optionslots[0] = new Slots(btnOptions[0], new BufferedImage[] { null, slotsHori[1], slotsHori[1] }, optionsPos[0], 0); 54 | optionslots[1] = new Slots(btnOptions[1], new BufferedImage[] { null, slotsHori[1], slotsHori[0] }, optionsPos[1], 0); 55 | 56 | return optionslots; 57 | } 58 | 59 | private Slots[] createBuildingUI() { 60 | SpriteSheet slots = new SpriteSheet("ui/slots.png"); 61 | 62 | BufferedImage imgButton = GameStateManager.button.getSubimage(0, 137, 40, 40); 63 | BufferedImage imgPressed = GameStateManager.button.getSubimage(41, 137, 40, 40); 64 | 65 | BufferedImage slotsHori[] = { 66 | slots.getSubimage(409, 80, 14, 24), // ends 67 | slots.getSubimage(389, 76, 4, 32) // chain 68 | }; 69 | 70 | int size = 40; 71 | int buildSlotX = GamePanel.width - size - 15; 72 | int buildSlotY = GamePanel.height / 3; 73 | 74 | Slots[] gatherSlots = createGather(size, buildSlotX, buildSlotY, slotsHori); 75 | 76 | BufferedImage slotsVert[] = { 77 | slots.getSubimage(393, 56, 24, 14), // ends 78 | slots.getSubimage(389, 71, 32, 4) // chain 79 | }; 80 | 81 | Button[] btnBuilding = new Button[3]; 82 | for (int i = 0; i < btnBuilding.length; i++) { 83 | btnBuilding[i] = new Button(icons.getSprite(i, 0).image, imgButton, 84 | new Vector2f(buildSlotX, buildSlotY + ((size + 10) * i)), size, size, 8); 85 | btnBuilding[i].addPressedImage(imgPressed); 86 | } 87 | 88 | 89 | 90 | Vector2f[][] slotsPos = new Vector2f[btnBuilding.length][slotsVert.length]; 91 | 92 | int img = 0; 93 | for (int i = 0; i < btnBuilding.length; i++) { 94 | for (int j = 0; j < slotsPos[0].length; j++) { 95 | img = i > 0 ? 1 : j; 96 | slotsPos[i][j] = new Vector2f( 97 | buildSlotX + ((size + 8) - slotsVert[img].getWidth()) / 2, 98 | buildSlotY + ((size + 10) * i) + ((size + 18) * (j % 2)) - slotsVert[img].getHeight()); 99 | } 100 | } 101 | 102 | Slots[] buildingslots = new Slots[btnBuilding.length]; // probably make this a for loop later... 103 | buildingslots[0] = new Slots(btnBuilding[0], gatherSlots, new BufferedImage[] { null, slotsVert[0], slotsVert[1] }, slotsPos[0], 0); 104 | buildingslots[1] = new Slots(btnBuilding[1], new BufferedImage[] { null, slotsVert[1], slotsVert[1] }, slotsPos[1], 0); 105 | buildingslots[2] = new Slots(btnBuilding[2], new BufferedImage[] { null, slotsVert[1], null }, slotsPos[2], 0); 106 | 107 | buildingButtons(buildingslots); 108 | 109 | return buildingslots; 110 | } 111 | 112 | private void buildingButtons(Slots[] buildingslots) { 113 | for(int i = 0; i < buildingslots.length; i++) { 114 | buildingslots[i].getButton().addSlotEvent(e -> { 115 | if(e.isVisibleChildren()) { 116 | e.showChildren(false); 117 | } else { 118 | e.showChildren(true); 119 | } 120 | }); 121 | } 122 | 123 | } 124 | 125 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/ui/ClickedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.ui; 2 | 3 | public interface ClickedEvent { 4 | void action(int mouseButton); 5 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/ui/FillBars.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.ui; 2 | 3 | import java.awt.Graphics2D; 4 | import java.awt.image.BufferedImage; 5 | 6 | import com.zerulus.game.entity.Entity; 7 | import com.zerulus.game.math.Vector2f; 8 | 9 | public class FillBars { 10 | 11 | private BufferedImage[] bar; // 1: bar, 2: energy, 3: ends 12 | 13 | private Entity e; 14 | 15 | private Vector2f pos; 16 | private int size; 17 | private int length; 18 | 19 | private int energyLength; 20 | 21 | private int barWidthRatio; 22 | private int energyWidthRatio; 23 | 24 | private int barHeightRatio; 25 | 26 | public FillBars(Entity e, BufferedImage[] sprite, Vector2f pos, int size, int length) { 27 | this.e = e; 28 | this.bar = sprite; 29 | this.pos = pos; 30 | this.size = size; 31 | this.length = length; 32 | 33 | // bars must have at least two sprites... 34 | 35 | this.energyLength = (int) ((bar[0].getWidth() + size) * (length * e.getHealthPercent())); 36 | 37 | this.barWidthRatio = (bar[0].getWidth() + size) * length / (bar[0].getWidth()); 38 | this.energyWidthRatio = energyLength / (bar[0].getWidth()); 39 | 40 | this.barHeightRatio = (bar[0].getHeight() + size) / bar[0].getHeight(); 41 | } 42 | 43 | public void render(Graphics2D g) { 44 | int endsWidth = 0; 45 | int centerHeight = (int) (pos.y - barHeightRatio - bar[0].getHeight() / 2); 46 | 47 | this.energyLength = (int) ((bar[0].getWidth() + size) * (length * e.getHealthPercent())); 48 | this.energyWidthRatio = this.energyLength / (bar[0].getWidth()); 49 | 50 | if(bar[2] != null) { 51 | endsWidth = bar[2].getWidth() + size; 52 | 53 | g.drawImage(bar[2], (int) (pos.x), (int) (pos.y), endsWidth, bar[2].getHeight() + size, null); 54 | g.drawImage(bar[2], (int) (pos.x + endsWidth * 2 + (bar[0].getWidth() + size) * length) - this.barWidthRatio, (int) (pos.y), -(endsWidth), bar[2].getHeight() + size, null); 55 | centerHeight += bar[2].getHeight() / 2 + (bar[2].getHeight() - bar[0].getHeight()) / 2; 56 | } 57 | 58 | g.drawImage(bar[0], (int) (pos.x + endsWidth - this.barWidthRatio), centerHeight, (bar[0].getWidth() + size) * length, bar[0].getHeight() + size, null); 59 | g.drawImage(bar[1], (int) (pos.x + endsWidth - this.energyWidthRatio), centerHeight, this.energyLength, (int) (bar[0].getHeight() + size), null); 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/ui/PlayerUI.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.ui; 2 | 3 | import com.zerulus.game.GamePanel; 4 | import com.zerulus.game.entity.Player; 5 | import com.zerulus.game.graphics.SpriteSheet; 6 | import com.zerulus.game.math.Vector2f; 7 | import com.zerulus.game.util.KeyHandler; 8 | import com.zerulus.game.util.MouseHandler; 9 | 10 | import java.awt.image.BufferedImage; 11 | import java.awt.Graphics2D; 12 | 13 | public class PlayerUI { 14 | 15 | private FillBars healthbar; 16 | private Slots[] buildingslots; 17 | 18 | public PlayerUI(Player p) { 19 | 20 | SpriteSheet bars = new SpriteSheet("ui/fillbars.png"); 21 | BufferedImage[] barSprites = { 22 | bars.getSubimage(12, 2, 7, 16), 23 | bars.getSubimage(39, 0, 7, 14), // red health bar 24 | bars.getSubimage(0, 0, 12, 20) }; 25 | 26 | Vector2f pos = new Vector2f(32, GamePanel.height - 52); 27 | this.healthbar = new FillBars(p, barSprites, pos, 16, 16); 28 | 29 | BuildOptionUI boUI = new BuildOptionUI(); 30 | buildingslots = boUI.getSlots(); 31 | } 32 | 33 | 34 | public void update(double time) { 35 | for(int i = 0; i < buildingslots.length; i++) { 36 | buildingslots[i].update(time); 37 | } 38 | } 39 | 40 | public void input(MouseHandler mouse, KeyHandler key) { 41 | for(int i = 0; i < buildingslots.length; i++) { 42 | buildingslots[i].input(mouse, key); 43 | } 44 | } 45 | 46 | public void render(Graphics2D g) { 47 | healthbar.render(g); 48 | 49 | for(int i = 0; i < buildingslots.length; i++) { 50 | buildingslots[i].render(g); 51 | } 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/ui/Slots.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.ui; 2 | 3 | import com.zerulus.game.math.Vector2f; 4 | import com.zerulus.game.util.KeyHandler; 5 | import com.zerulus.game.util.MouseHandler; 6 | 7 | import java.awt.image.BufferedImage; 8 | import java.awt.Graphics2D; 9 | 10 | public class Slots { 11 | 12 | private Vector2f[] pos; 13 | private BufferedImage[] slot; // 1: slot, 2: front || top, 3: back || bottom 14 | private Slots[] childSlots; 15 | private Button button; 16 | 17 | private int width; 18 | private int height; 19 | 20 | private int size = 0; 21 | private boolean visibility = true; 22 | private boolean showChildren = false; 23 | 24 | // Once we have items we will create an items and inventory class 25 | public Slots(BufferedImage[] sprite, Vector2f[] pos, int size) { 26 | this.slot = sprite; 27 | this.pos = pos; 28 | this.size = size; 29 | 30 | if(sprite[0] != null) { 31 | this.width = sprite[0].getWidth() + size; 32 | this.height = sprite[0].getHeight() + size; 33 | } 34 | } 35 | 36 | public Slots(Button button, BufferedImage[] sprite, Vector2f[] pos, int size) { 37 | this(sprite, new Vector2f[]{ button.getPos(), pos[0], pos[1] }, size); // is this okay? 38 | this.button = button; 39 | 40 | this.width = button.getWidth() + size; 41 | this.height = button.getHeight() + size; 42 | 43 | this.button.setSlot(this); // temp fix 44 | } 45 | 46 | public Slots(Button button, Slots[] childSlots, BufferedImage[] sprite, Vector2f[] pos, int size) { 47 | this(sprite, new Vector2f[]{ button.getPos(), pos[0], pos[1] }, size); // is this okay? 48 | this.button = button; 49 | 50 | this.width = button.getWidth() + size; 51 | this.height = button.getHeight() + size; 52 | this.childSlots = childSlots; 53 | 54 | this.button.setSlot(this); // temp fix 55 | } 56 | 57 | public void setVisible(boolean b) { visibility = b; } 58 | public void showChildren(boolean b) { showChildren = (childSlots != null) ? b : false; } 59 | 60 | public Button getButton() { return button; } 61 | public boolean isVisibleChildren() { return showChildren; } 62 | 63 | public void update(double time) { 64 | button.update(time); 65 | 66 | if(showChildren) { 67 | for(int i = 0; i < childSlots.length; i++) { 68 | childSlots[i].update(time); 69 | } 70 | } 71 | } 72 | 73 | public void input(MouseHandler mouse, KeyHandler key) { 74 | button.input(mouse, key); 75 | 76 | if(showChildren) { 77 | for(int i = 0; i < childSlots.length; i++) { 78 | childSlots[i].input(mouse, key); 79 | } 80 | } 81 | } 82 | 83 | public void render(Graphics2D g) { 84 | 85 | if(!visibility) return; 86 | 87 | if(button != null) { 88 | button.render(g); 89 | } else { 90 | g.drawImage(slot[0], (int) pos[0].x, (int) pos[0].y, width, height, null); 91 | } 92 | for(int i = 1; i < slot.length; i++) { 93 | if(slot[i] == null) continue; 94 | g.drawImage(slot[i], 95 | (int) pos[i].x - ((slot[i].getWidth() + size) / slot[i].getWidth()) + 1, 96 | (int) pos[i].y - ((slot[i].getHeight() + size) / slot[i].getHeight()) + 1, 97 | slot[i].getWidth() + size, 98 | slot[i].getHeight() + size, null); 99 | } 100 | 101 | if(showChildren) { 102 | for(int i = 0; i < childSlots.length; i++) { 103 | childSlots[i].render(g); 104 | } 105 | } 106 | 107 | } 108 | 109 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/util/GameObjectHeap.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.util; 2 | 3 | import java.util.ArrayList; 4 | 5 | import com.zerulus.game.entity.GameObject; 6 | 7 | // Maybe Quicksort? 8 | public class GameObjectHeap extends ArrayList { 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | public void buildHeap() { 13 | for(int i = size() / 2; i >= 0; i--) { 14 | minHeapify(i); 15 | } 16 | } 17 | 18 | public void add(float value, GameObject go) { 19 | GameObjectKey gok = new GameObjectKey(value, go); 20 | super.add(gok); 21 | 22 | int i = size() - 1; 23 | int parent = parent(i); 24 | 25 | if(i > 3) { 26 | while(parent != i && get(i).value < get(parent).value) { 27 | swap(i, parent); 28 | i = parent; 29 | parent = parent(i); 30 | } 31 | } 32 | } 33 | 34 | public boolean contains(GameObject go) { 35 | for(int i = 0; i < size(); i++) { 36 | if(go.equals(get(i).go) ) { 37 | return true; 38 | } 39 | } 40 | 41 | return false; 42 | } 43 | 44 | public void remove(GameObject go) { 45 | for(int i = 0; i < size(); i++) { 46 | if(go.equals(get(i).go)) { 47 | super.remove(i); 48 | } 49 | } 50 | } 51 | 52 | private void minHeapify(int i) { 53 | int left = 2 * i + 1; 54 | int right = 2 * i + 2; 55 | int smallest = -1; 56 | 57 | if(left < size() - 1 && get(left).value < get(i).value) { 58 | smallest = left; 59 | } else { 60 | smallest = i; 61 | } 62 | 63 | if(right < size() - 1 && get(right).value < get(smallest).value) { 64 | smallest = right; 65 | } 66 | 67 | if(smallest != i) { 68 | swap(i, smallest); 69 | minHeapify(smallest); 70 | } 71 | } 72 | 73 | private int parent(int i) { 74 | if(i % 2 == 1) { 75 | return i / 2; 76 | } 77 | 78 | return (i - 1) / 2; 79 | } 80 | 81 | private void swap(int i, int parent) { 82 | GameObjectKey temp = get(parent); 83 | set(parent, get(i)); 84 | set(i, temp); 85 | } 86 | 87 | public String toString() { 88 | String string = "["; 89 | 90 | for(int i = 0; i < size(); i++) { 91 | string += get(i).value + ", "; 92 | } 93 | 94 | string += "]"; 95 | 96 | return string; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/util/GameObjectKey.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.util; 2 | 3 | import com.zerulus.game.entity.GameObject; 4 | import com.zerulus.game.math.AABB; 5 | 6 | public class GameObjectKey { 7 | 8 | public float value; 9 | public GameObject go; 10 | 11 | public GameObjectKey(float value, GameObject go) { 12 | this.value = value; 13 | this.go = go; 14 | } 15 | 16 | public AABB getBounds() { return go.getBounds(); } 17 | } -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/util/KeyHandler.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.util; 2 | 3 | import com.zerulus.game.GamePanel; 4 | 5 | import java.awt.event.KeyEvent; 6 | import java.awt.event.KeyListener; 7 | import java.util.List; 8 | import java.util.ArrayList; 9 | 10 | public class KeyHandler implements KeyListener{ 11 | 12 | public static List keys = new ArrayList(); 13 | 14 | public class Key { 15 | public int presses, absorbs; 16 | public boolean down, clicked; 17 | 18 | public Key() { 19 | keys.add(this); 20 | } 21 | 22 | public void toggle(boolean pressed) { 23 | if(pressed != down) { 24 | down = pressed; 25 | } 26 | if(pressed) { 27 | presses++; 28 | } 29 | } 30 | 31 | public void tick() { 32 | if(absorbs < presses) { 33 | absorbs++; 34 | clicked = true; 35 | } else { 36 | clicked = false; 37 | } 38 | } 39 | } 40 | 41 | public Key up = new Key(); 42 | public Key down = new Key(); 43 | public Key left = new Key(); 44 | public Key right = new Key(); 45 | public Key attack = new Key(); 46 | public Key menu = new Key(); 47 | public Key enter = new Key(); 48 | public Key escape = new Key(); 49 | public Key shift = new Key(); 50 | public Key f1 = new Key(); 51 | 52 | public KeyHandler(GamePanel game) { 53 | game.addKeyListener(this); 54 | } 55 | 56 | public void releaseAll() { 57 | for(int i = 0; i < keys.size(); i++) { 58 | keys.get(i).down = false; 59 | } 60 | } 61 | 62 | public void tick() { 63 | for(int i = 0; i < keys.size(); i++) { 64 | keys.get(i).tick(); 65 | } 66 | } 67 | 68 | public void toggle(KeyEvent e, boolean pressed) { 69 | if(e.getKeyCode() == KeyEvent.VK_W) up.toggle(pressed); 70 | if(e.getKeyCode() == KeyEvent.VK_S) down.toggle(pressed); 71 | if(e.getKeyCode() == KeyEvent.VK_A) left.toggle(pressed); 72 | if(e.getKeyCode() == KeyEvent.VK_D) right.toggle(pressed); 73 | if(e.getKeyCode() == KeyEvent.VK_SPACE) attack.toggle(pressed); 74 | if(e.getKeyCode() == KeyEvent.VK_E) menu.toggle(pressed); 75 | if(e.getKeyCode() == KeyEvent.VK_ENTER) enter.toggle(pressed); 76 | if(e.getKeyCode() == KeyEvent.VK_ESCAPE) escape.toggle(pressed); 77 | if(e.getKeyCode() == KeyEvent.VK_F1) f1.toggle(pressed); 78 | if(e.getKeyCode() == KeyEvent.VK_SHIFT) shift.toggle(pressed); 79 | } 80 | 81 | 82 | @Override 83 | public void keyTyped(KeyEvent e) { 84 | // do nothing 85 | } 86 | 87 | @Override 88 | public void keyPressed(KeyEvent e) { 89 | toggle(e, true); 90 | } 91 | 92 | @Override 93 | public void keyReleased(KeyEvent e) { 94 | toggle(e, false); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/util/MouseHandler.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.util; 2 | 3 | 4 | import com.zerulus.game.GamePanel; 5 | 6 | import java.awt.event.MouseEvent; 7 | import java.awt.event.MouseListener; 8 | import java.awt.event.MouseMotionListener; 9 | 10 | public class MouseHandler implements MouseListener, MouseMotionListener { 11 | 12 | private static int mouseX = -1; 13 | private static int mouseY = -1; 14 | private static int mouseB = -1; 15 | 16 | public MouseHandler(GamePanel game) { 17 | game.addMouseListener(this); 18 | game.addMouseMotionListener(this); 19 | } 20 | 21 | public int getX() { 22 | return mouseX; 23 | } 24 | 25 | public int getY() { 26 | return mouseY; 27 | } 28 | 29 | public int getButton() { 30 | return mouseB; 31 | } 32 | 33 | 34 | @Override 35 | public void mouseClicked(MouseEvent e) { 36 | 37 | } 38 | 39 | @Override 40 | public void mousePressed(MouseEvent e) { 41 | mouseB = e.getButton(); 42 | } 43 | 44 | @Override 45 | public void mouseReleased(MouseEvent e) { 46 | mouseB = -1; 47 | } 48 | 49 | @Override 50 | public void mouseEntered(MouseEvent e) { 51 | 52 | } 53 | 54 | @Override 55 | public void mouseExited(MouseEvent e) { 56 | 57 | } 58 | 59 | @Override 60 | public void mouseDragged(MouseEvent e) { 61 | mouseX = e.getX(); 62 | mouseY = e.getY(); 63 | } 64 | 65 | @Override 66 | public void mouseMoved(MouseEvent e) { 67 | mouseX = e.getX(); 68 | mouseY = e.getY(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /game-decay/src/main/java/com/zerulus/game/util/TileCollision.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game.util; 2 | 3 | import com.zerulus.game.entity.Entity; 4 | import com.zerulus.game.tiles.TileMapObj; 5 | import com.zerulus.game.tiles.blocks.Block; 6 | import com.zerulus.game.tiles.blocks.HoleBlock; 7 | 8 | public class TileCollision { 9 | 10 | private Entity e; 11 | private int tileId; 12 | 13 | public TileCollision(Entity e) { 14 | this.e = e; 15 | } 16 | 17 | public boolean normalTile(float ax, float ay) { 18 | int xt; 19 | int yt; 20 | 21 | xt = (int) ( (e.getPos().x + ax) + e.getBounds().getXOffset()) / 64; 22 | yt = (int) ( (e.getPos().y + ay) + e.getBounds().getYOffset()) / 64; 23 | tileId = (xt + (yt * TileMapObj.height)); 24 | 25 | if(tileId > TileMapObj.height * TileMapObj.width) tileId = (TileMapObj.height * TileMapObj.width) - 2; 26 | 27 | return false; 28 | } 29 | 30 | public boolean collisionTile(float ax, float ay) { 31 | if(TileMapObj.event_blocks != null) { 32 | int xt; 33 | int yt; 34 | 35 | for(int c = 0; c < 4; c++) { 36 | 37 | xt = (int) ( (e.getPos().x + ax) + (c % 2) * e.getBounds().getWidth() + e.getBounds().getXOffset()) / 64; 38 | yt = (int) ( (e.getPos().y + ay) + (c / 2) * e.getBounds().getHeight() + e.getBounds().getYOffset()) / 64; 39 | 40 | if(xt <= 0 || yt <= 0 || xt + (yt * TileMapObj.height) < 0 || xt + (yt * TileMapObj.height) > (TileMapObj.height * TileMapObj.width) - 2) { 41 | return true; 42 | } 43 | 44 | if(TileMapObj.event_blocks[xt + (yt * TileMapObj.height)] instanceof Block) { 45 | Block block = TileMapObj.event_blocks[xt + (yt * TileMapObj.height)]; 46 | if(block instanceof HoleBlock) { 47 | return collisionHole(ax, ay, xt, yt, block); 48 | } 49 | return block.update(e.getBounds()); 50 | } 51 | } 52 | } 53 | 54 | return false; 55 | } 56 | 57 | public int getTile() { return tileId; } 58 | 59 | private boolean collisionHole(float ax, float ay, float xt, float yt, Block block) { 60 | int nextXt = (int) ((( (e.getPos().x + ax) + e.getBounds().getXOffset()) / 64) + e.getBounds().getWidth() / 64); 61 | int nextYt = (int) ((( (e.getPos().y + ay) + e.getBounds().getYOffset()) / 64) + e.getBounds().getHeight() / 64); 62 | 63 | if(block.isInside(e.getBounds())) { 64 | e.setFallen(true); 65 | return false; 66 | } 67 | else if((nextXt == yt + 1) || (nextXt == xt + 1) || (nextYt == yt - 1) || (nextXt == xt - 1)) { 68 | if(TileMapObj.event_blocks[nextXt + (nextYt * TileMapObj.height)] instanceof HoleBlock){ 69 | Block nextblock = TileMapObj.event_blocks[nextXt + (nextYt * TileMapObj.height)]; 70 | 71 | if(e.getPos().x + e.getBounds().getXOffset() > block.getPos().x 72 | && e.getPos().y + e.getBounds().getYOffset() > block.getPos().y 73 | && nextblock.getWidth() + nextblock.getPos().x > e.getBounds().getWidth() + (e.getPos().x + e.getBounds().getXOffset()) 74 | && nextblock.getHeight() + nextblock.getPos().y > e.getBounds().getHeight() + (e.getPos().y + e.getBounds().getYOffset())) { 75 | e.setFallen(true); 76 | } 77 | return false; 78 | } 79 | } 80 | 81 | e.setFallen(false); 82 | return false; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/CitizenSheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/CitizenSheet.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/Smoke0000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/Smoke0000.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/Smoke0001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/Smoke0001.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/Smoke0002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/Smoke0002.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0000.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0001.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0002.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0003.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0004.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0005.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0006.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0007.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0008.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0009.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0010.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0011.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0012.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0013.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0014.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/buttons0015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/buttons0015.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/castle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/castle.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/chapel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/chapel.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/clock.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/crops.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/crops.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/dirt.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/firtree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/firtree.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/fish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/fish.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/fruit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/fruit.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/house.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/inn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/inn.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/marblepath.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/marblepath.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/newgrass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/newgrass.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/oaktree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/oaktree.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/pinetree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/pinetree.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/preview.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/tailor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/tailor.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/tavern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/tavern.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/thatched.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/thatched.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/treehouse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/treehouse.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/villa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/villa.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0000.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0001.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0002.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0003.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0004.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0005.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0006.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0007.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0008.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0009.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/wal0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/wal0010.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/Sprites/watchtower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/Sprites/watchtower.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/buildings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/buildings.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/iso-64x64-building.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/iso-64x64-building.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/building/jpisotbs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/building/jpisotbs.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/Dwarf_Sprite_Sheet1.2v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/Dwarf_Sprite_Sheet1.2v.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/Minotaur - Sprite Sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/Minotaur - Sprite Sheet.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/bigmonster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/bigmonster.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/flaming skull design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/flaming skull design.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/goblin spritesheet calciumtrice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/goblin spritesheet calciumtrice.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/littlegirl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/littlegirl.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/minimonsters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/minimonsters.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/monsters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/monsters.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/orc spritesheet calciumtrice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/orc spritesheet calciumtrice.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/enemy/skeleton spritesheet calciumtrice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/enemy/skeleton spritesheet calciumtrice.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/linkformatted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/linkformatted.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/littlegirl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/littlegirl.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/link.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/player_referrence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/player_referrence.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack down_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack down_0.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack down_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack down_1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack down_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack down_2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack down_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack down_3.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack left_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack left_0.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack left_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack left_1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack left_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack left_2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack left_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack left_3.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack right_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack right_0.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack right_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack right_1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack right_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack right_2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack right_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack right_3.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack up_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack up_0.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack up_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack up_1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack up_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack up_2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack up_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack animations_attack up_3.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_0.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_3.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_4.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_5.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_6.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_7.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_8.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like attack_Animation 1_9.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like idle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like idle.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like idle_Animation 1_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like idle_Animation 1_0.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like idle_Animation 1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like idle_Animation 1_1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like idle_Animation 1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like idle_Animation 1_2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run up_Animation 1_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run up_Animation 1_0.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run up_Animation 1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run up_Animation 1_1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run up_Animation 1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run up_Animation 1_2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run up_Animation 1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run up_Animation 1_3.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_0.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_3.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_4.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/rogue like run_Animation 1_5.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/roguelike run down_Animation 1_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/roguelike run down_Animation 1_0.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/roguelike run down_Animation 1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/roguelike run down_Animation 1_1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/roguelike run down_Animation 1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/roguelike run down_Animation 1_2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/references/rogue like character/roguelike run down_Animation 1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/references/rogue like character/roguelike run down_Animation 1_3.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/wizardPlayer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/wizardPlayer.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/workinprogress/playerformatted.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/workinprogress/playerformatted.pdn -------------------------------------------------------------------------------- /game-decay/src/main/resources/entity/workinprogress/playerformatted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/entity/workinprogress/playerformatted.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/font/GravityBold8.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/font/GravityBold8.ttf -------------------------------------------------------------------------------- /game-decay/src/main/resources/font/Stackedpixel.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/font/Stackedpixel.ttf -------------------------------------------------------------------------------- /game-decay/src/main/resources/font/ZeldaFont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/font/ZeldaFont.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/font/cbbpv-crxg4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/font/cbbpv-crxg4.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/font/cbiak-org1k.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/font/cbiak-org1k.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/font/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/font/font.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/font/galaxyfont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/font/galaxyfont.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/item/The Humble Item Pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/item/The Humble Item Pack.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/item/items.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/item/items.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/material/treepacknewest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/material/treepacknewest.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/material/trees.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/material/trees.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/new/Adventurer-1.5.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/new/Adventurer-1.5.zip -------------------------------------------------------------------------------- /game-decay/src/main/resources/new/Adventurer-Bow.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/new/Adventurer-Bow.zip -------------------------------------------------------------------------------- /game-decay/src/main/resources/new/Adventurer-Hand-Combat.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/new/Adventurer-Hand-Combat.zip -------------------------------------------------------------------------------- /game-decay/src/main/resources/new/Roguelike Dungeon - Asset Bundle.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/new/Roguelike Dungeon - Asset Bundle.rar -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/0x72_DungeonTilesetII_v1.2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/0x72_DungeonTilesetII_v1.2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/Dungeon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/Dungeon1.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/OutdoorsTileset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/OutdoorsTileset.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/TilesetGraveyard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/TilesetGraveyard.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/dungeon_tiles_formatted_v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/dungeon_tiles_formatted_v2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/interactivetiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/interactivetiles.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/overworld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/overworld.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/overworldOP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/overworldOP.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/tempmappng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/tempmappng.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/tile/terrain_atlas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/tile/terrain_atlas.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/#1 - Transparent Icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/#1 - Transparent Icons.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/#2 - Transparent & Drop Shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/#2 - Transparent & Drop Shadow.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 10.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 1a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 1a.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 1b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 1b.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 2.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 2a.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 2b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 2b.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 2c.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 3a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 3a.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 3b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 3b.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 4.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 5.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 6.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 7.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 8.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Background 9.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/Shikashi's Fantasy Icons Pack/Shikashi's Fantasy Icons Pack.txt: -------------------------------------------------------------------------------- 1 | 2 | ____________________________________________________________ 3 | 4 | Thank you for purchasing this pack! Best of luck with your game or project! 5 | 6 | 7 | This is an icon pack with 209 unique icons and 36 recolours, with 245 icons in total. The spritesheet and 32x32 icon size were designed with RPG Maker MV in mind, but these icons can be used for any project that can use 32x32 sprites. There are several icon backgrounds to choose from, along with the original transparent option. 8 | 9 | You can use and remix these icons for commercial games and projects. Many of these icons were based on the designs over at game-icons.net which are CC BY 3.0. 10 | 11 | 12 | Here are all of the icons in the pack listed, in order: 13 | 14 | 11 STATUS EFFECTS. Skull and bones, poison, sleeping eye, silenced, cursed, dizzy, charmed, sleeping, paralysis, burned, sweat-drop. 15 | 16 | 5 BODY ICONS. Heart, lungs, stomach, brain, strong arm. 17 | 18 | 7 BUFFS & DEBUFFS. x3 buff arrows, x3 debuff arrows, repeat arrow. 19 | 20 | 16 SPECIAL MOVES. Dripping blade, saber slash, lightning attack, headshot, raining arrows, healing, heal injury, battle gear, guard, ring of fire, disintegrate, fist hit, gust of air, tremor, psychic waves, sunrays. 21 | 22 | 9 NON COMBAT ACTIONS. Square speech bubble, round speech bubble, campfire, camping tent, blacksmith/forging, mining, woodcutting, spellbook, steal. 23 | 24 | 28 WEAPONS. Wooden waster, longsword, enchanted sword, katana, gladius, saber, dagger, broad dagger, sai, crossed/dual swords, war axe, battle axe, flail, spiked club, whip, fist, buckler shield, wooden shield, checkered shield, bow & arrow, crossbow, slingshot, boomerang, wizard staff, x4 magic gem staffs. 25 | 26 | 26 CLOTHING & ARMOUR. Robin hood hat, barbute helm, leather helm, cross helm, iron armour, steel armour, leather armour, layered plate armour, blue tunic, green tunic, trousers, shorts, heart boxers, dress, cloak, belt, leather gauntlet, metal gauntlet, leather boots, steeltoe boots, ring, diamond ring, gold necklace, prayer beads, tribal necklace, leather pouch. 27 | 28 | 16 HEALING ITEMS. X4 Normal potions, x4 upgraded potions, x4 rare potions, x3 special brew potions, bandage. 29 | 30 | 64 GENERAL ITEMS. Knapsack, axe, pickaxe, shovel, hammer, grappling hook, hookshot, telescope, magnifying glass, lantern, torch, candle, bomb, rope, bear trap, hourglass. Runestone, mirror, shackles, lyre, violin, ocarina, flute, panpipes, hunting/war horn, brass key, silver keyring, treasure chest, mortar and pestle, herb1, herb2, herb. Mushrooms, flower bulb, root tip, plant-pot seedling, plant-pot growing, plant-pot fully grown, money purse, crown coin, bronze coin stack, silver coin stack, gold coin stack, large gold coin stack, receive money, pay money, gems, rupee. x8 books, open book, letter, tied scroll, open scroll, old map, dice, card, bottle of wine. 31 | 32 | 31 FOOD. Apple, banana, pear, lemon, strawberry, grapes, carrot, sweetcorn, garlic, tomato, eggplant/aubergine, red chili, mushroom, loaf of bread, baguette, whole chicken. Chicken leg, sirloin steak, ham, morsel, cooked fish, eggs, big egg, cheese, milk, honey, salt, spices, candy, cake, drink. 33 | 34 | 15 FISHING ITEMS. Fishing rod, fishing hook, worm bait, lake trout, brown trout, eel, tropical fish, clownfish, jellyfish, octopus, turtle, fish-bone, old boot, fossil, sunken chest. 35 | 36 | 11 RESOURCES. Wood, stone, ore, gold, gems, cotton, yarn, cloth, pelts, monster claw, feathers. 37 | 38 | 6 ORBS. x6 Orbs of different colours. 39 | 40 | ____________________________________________________________ -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/buttons.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/fillbars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/fillbars.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/icons.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/slots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/slots.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/ui.png -------------------------------------------------------------------------------- /game-decay/src/main/resources/ui/ui_big_pieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/game-decay/src/main/resources/ui/ui_big_pieces.png -------------------------------------------------------------------------------- /game-decay/src/test/java/com/zerulus/game/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.zerulus.game; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest { 11 | /** 12 | * Rigorous Test. 13 | */ 14 | @Test 15 | public void testApp() { 16 | 17 | int data = 0; 18 | 19 | int tile = 0; 20 | int material = 0; 21 | 22 | int tilesetSize = 50; 23 | int numMaterials = 5; 24 | 25 | for(int i = 0; i < tilesetSize; i++) { 26 | for(int j = 0; j < numMaterials; j++) { 27 | data = i + (tilesetSize * (numMaterials + j)); 28 | material = (int) ((data / tilesetSize) % numMaterials); 29 | tile = data - (tilesetSize * (numMaterials + material)); 30 | 31 | assertFalse("tile: " + tile + " i: " + i, tile != i); 32 | assertFalse("material: " + material + " j: " + j, material != j); 33 | } 34 | } 35 | 36 | assertTrue(true); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /pic/demo_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/pic/demo_0.png -------------------------------------------------------------------------------- /pic/demo_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZeroDoctor/yt-java-game/a034529d7852d3dbf41ba2b3a9ccda4d6debb40e/pic/demo_1.png --------------------------------------------------------------------------------