Skip to content

Commit 1fcd108

Browse files
Merge pull request #1 from ashish2199/Ashish2199-newKeyboardhandling
Ashish2199 new keyboardhandling
2 parents 9e3d27a + d316c2f commit 1fcd108

File tree

16 files changed

+204
-388
lines changed

16 files changed

+204
-388
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# Aidos
2-
A beginner friendly project
2+
A beginner friendly project with aim of creating our own version of Bomberman.
3+
4+
![Alt Text](https://media.giphy.com/media/xUOxf8uHAc2OIclI9a/giphy.gif)

src/Bomberman/entity/Entity.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/Bomberman/entity/MovingEntity.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/Bomberman/entity/StaticEntity.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/Bomberman/entity/boundedbox/RectBoundedBox.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/Bomberman/entity/player/Player.java

Lines changed: 0 additions & 145 deletions
This file was deleted.

src/Bomberman/entity/staticobjects/Wall.java

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/bomberman/GameLoop.java

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
11
package bomberman;
22

3-
import bomberman.constants.Direction;
4-
import bomberman.entity.player.Player;
3+
import bomberman.constants.GlobalConstants;
4+
import bomberman.entity.Entity;
5+
import bomberman.gamecontroller.InputManager;
6+
import bomberman.scenes.Sandbox;
57
import javafx.animation.AnimationTimer;
68
import javafx.scene.canvas.GraphicsContext;
79

8-
public class GameLoop
9-
{
10-
static double tickDuration;
11-
final static long startNanoTime = System.nanoTime();
12-
public static Player player = new Player();
10+
public class GameLoop {
11+
12+
static double tickDuration;
13+
final static long startNanoTime = System.nanoTime();
1314

1415
public static double getTickDuration() {
1516
return tickDuration;
1617
}
1718

18-
public static void start(GraphicsContext gc)
19-
{
19+
public static void start(GraphicsContext gc) {
20+
GameState.gameStatus=GlobalConstants.GameStatus.Running;
2021
new AnimationTimer() {
2122
public void handle(long currentNanoTime) {
2223
tickDuration = (currentNanoTime - startNanoTime) / 1000000000.0;
2324
gc.clearRect(0, 0, 512, 512);
24-
player.draw();
25-
//Change this too see the different sprites and movement in action
26-
//player.move(Direction.RIGHT);
25+
//TODO This will have to be something like, currentScene.getEntities()
26+
updateGame();
27+
renderGame();
2728
}
2829
}.start();
29-
}
30+
}
31+
32+
public static void updateGame() {
33+
InputManager.handlePlayerMovements();
34+
}
35+
36+
public static void renderGame() {
37+
for (Entity e : Sandbox.getEntities()) {
38+
e.draw();
39+
}
40+
}
41+
3042
}

src/bomberman/GameState.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
*/
66
package bomberman;
77

8+
import bomberman.constants.GlobalConstants;
89
import java.util.Date;
910

1011
/**
1112
*
1213
* @author ashish.padalkar
1314
*/
1415
public class GameState {
15-
int level;
16-
Date lastSaved;
17-
boolean hasUnsavedChanges;
16+
public static int level;
17+
public static Date lastSaved;
18+
public static boolean hasUnsavedChanges;
19+
public static GlobalConstants.GameStatus gameStatus;
1820
}

src/bomberman/constants/GlobalConstants.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public class GlobalConstants {
2020
public static String GAME_NAME = "BomberMan";
2121
public static String GAME_VERSION = " v 0.1";
2222
public static Color BACKGROUND_COLOR = Color.WHITE;
23-
public static int PLAYER_X = 200;
24-
public static int PLAYER_Y = 200;
2523
public static int PLAYER_WIDTH = 18;
2624
public static int PLAYER_HEIGHT = 21;
2725
public static int PLAYER_SCALE = 2;
28-
26+
public static enum GameStatus{
27+
Running,Paused,GameOver
28+
}
2929
}

0 commit comments

Comments
 (0)