From 9db64a204b9c291637a745f9bde4d8c993e3abf2 Mon Sep 17 00:00:00 2001 From: smpsnr Date: Tue, 4 Aug 2015 23:34:50 -0700 Subject: [PATCH] render buckets. increase game canvas size closes #3 --- .../roomfullofcats/GameController.java | 2 +- .../org/gamefolk/roomfullofcats/game/Game.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/gamefolk/roomfullofcats/GameController.java b/app/src/main/java/org/gamefolk/roomfullofcats/GameController.java index e64478f..df5e9c7 100644 --- a/app/src/main/java/org/gamefolk/roomfullofcats/GameController.java +++ b/app/src/main/java/org/gamefolk/roomfullofcats/GameController.java @@ -46,7 +46,7 @@ public void startGame(Level level) { // Make sure the canvas is the correct width. Stage stage = (Stage) root.getScene().getWindow(); canvas.widthProperty().set(stage.getWidth()); - canvas.heightProperty().set(stage.getHeight() / 2); + canvas.heightProperty().set((stage.getHeight() / 2) * 1.75); game = new Game(getGraphicsContext2D()); game.setLevel(level); diff --git a/app/src/main/java/org/gamefolk/roomfullofcats/game/Game.java b/app/src/main/java/org/gamefolk/roomfullofcats/game/Game.java index cfcf8c4..0fc153a 100644 --- a/app/src/main/java/org/gamefolk/roomfullofcats/game/Game.java +++ b/app/src/main/java/org/gamefolk/roomfullofcats/game/Game.java @@ -243,6 +243,24 @@ public void drawSprites() { bounds.getHeight()); } } + + for(int i = 0; i < buckets.length; i++) { + + Bucket bucket = buckets[i]; + + if (bucket == null) { + continue; + } + + FrameAnimation sprite = bucket.sprite; + Rectangle2D bounds = getCatBounds(i, (int) currentLevel.dimensions.height); + gc.drawImage( + sprite.getCurrentFrame(), + bounds.getMinX(), + bounds.getMinY(), + bounds.getWidth() + (bucket.things * 2), + bounds.getHeight() + (bucket.things * 2)); + } } public void removeCat(double x, double y) {