From 9bd969ae332aea51276673d79de0378ca5a41554 Mon Sep 17 00:00:00 2001 From: Ukko Koknevics Date: Sun, 18 Feb 2018 12:33:36 +0200 Subject: [PATCH] Fixed issues #1 and #2. #1 - Bird was moving at different speeds on different window sizes, making it unplayable on larger window sizes. #2 - Window title was "Hello World!". Yeah... --- src/res/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/res/script.js b/src/res/script.js index f88b8bb..4f96bd6 100644 --- a/src/res/script.js +++ b/src/res/script.js @@ -68,7 +68,7 @@ var holes = []; var speed; -var gravity = 1 / 500000; +var gravity = 1 / 2000000; // BufferedImage for double buffered rendering var buf = null; @@ -132,7 +132,7 @@ function update(delta) { checkHighscore(); } - y += speed.y; + y += speed.y * delta; if (y < 0) { y = 0; } @@ -251,7 +251,7 @@ function draw(g, width, height) { // make the frame var frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); -frame.setTitle("Hello World!"); +frame.setTitle("Flip-Floppy Bird"); // class is implemented here bcs i did it with the panel class, too var keyListener = new MyKeyListener({ @@ -261,7 +261,7 @@ var keyListener = new MyKeyListener({ System.exit(0); } else if (e.getKeyCode() == KeyEvent.VK_SPACE) { if (!gameover) { - speed.y = -1 / 1000; + speed.y = -1 / 3000; } } else if (e.getKeyCode() == KeyEvent.VK_R) { checkHighscore();