-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ashish2199/Ashish2199-newKeyboardhandling
Ashish2199 new keyboardhandling
- Loading branch information
Showing
16 changed files
with
204 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.