Skip to content

Commit

Permalink
Merge pull request #1 from ashish2199/Ashish2199-newKeyboardhandling
Browse files Browse the repository at this point in the history
Ashish2199 new keyboardhandling
  • Loading branch information
StewartWallace1115 authored Nov 25, 2017
2 parents 9e3d27a + d316c2f commit 1fcd108
Show file tree
Hide file tree
Showing 16 changed files with 204 additions and 388 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Aidos
A beginner friendly project
A beginner friendly project with aim of creating our own version of Bomberman.

![Alt Text](https://media.giphy.com/media/xUOxf8uHAc2OIclI9a/giphy.gif)
18 changes: 0 additions & 18 deletions src/Bomberman/entity/Entity.java

This file was deleted.

19 changes: 0 additions & 19 deletions src/Bomberman/entity/MovingEntity.java

This file was deleted.

14 changes: 0 additions & 14 deletions src/Bomberman/entity/StaticEntity.java

This file was deleted.

29 changes: 0 additions & 29 deletions src/Bomberman/entity/boundedbox/RectBoundedBox.java

This file was deleted.

145 changes: 0 additions & 145 deletions src/Bomberman/entity/player/Player.java

This file was deleted.

56 changes: 0 additions & 56 deletions src/Bomberman/entity/staticobjects/Wall.java

This file was deleted.

38 changes: 25 additions & 13 deletions src/bomberman/GameLoop.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
package bomberman;

import bomberman.constants.Direction;
import bomberman.entity.player.Player;
import bomberman.constants.GlobalConstants;
import bomberman.entity.Entity;
import bomberman.gamecontroller.InputManager;
import bomberman.scenes.Sandbox;
import javafx.animation.AnimationTimer;
import javafx.scene.canvas.GraphicsContext;

public class GameLoop
{
static double tickDuration;
final static long startNanoTime = System.nanoTime();
public static Player player = new Player();
public class GameLoop {

static double tickDuration;
final static long startNanoTime = System.nanoTime();

public static double getTickDuration() {
return tickDuration;
}

public static void start(GraphicsContext gc)
{
public static void start(GraphicsContext gc) {
GameState.gameStatus=GlobalConstants.GameStatus.Running;
new AnimationTimer() {
public void handle(long currentNanoTime) {
tickDuration = (currentNanoTime - startNanoTime) / 1000000000.0;
gc.clearRect(0, 0, 512, 512);
player.draw();
//Change this too see the different sprites and movement in action
//player.move(Direction.RIGHT);
//TODO This will have to be something like, currentScene.getEntities()
updateGame();
renderGame();
}
}.start();
}
}

public static void updateGame() {
InputManager.handlePlayerMovements();
}

public static void renderGame() {
for (Entity e : Sandbox.getEntities()) {
e.draw();
}
}

}
8 changes: 5 additions & 3 deletions src/bomberman/GameState.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
*/
package bomberman;

import bomberman.constants.GlobalConstants;
import java.util.Date;

/**
*
* @author ashish.padalkar
*/
public class GameState {
int level;
Date lastSaved;
boolean hasUnsavedChanges;
public static int level;
public static Date lastSaved;
public static boolean hasUnsavedChanges;
public static GlobalConstants.GameStatus gameStatus;
}
6 changes: 3 additions & 3 deletions src/bomberman/constants/GlobalConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public class GlobalConstants {
public static String GAME_NAME = "BomberMan";
public static String GAME_VERSION = " v 0.1";
public static Color BACKGROUND_COLOR = Color.WHITE;
public static int PLAYER_X = 200;
public static int PLAYER_Y = 200;
public static int PLAYER_WIDTH = 18;
public static int PLAYER_HEIGHT = 21;
public static int PLAYER_SCALE = 2;

public static enum GameStatus{
Running,Paused,GameOver
}
}
Loading

0 comments on commit 1fcd108

Please sign in to comment.