From 0c4bdd1d04a0e1290a60779f2a6fdbfa318d24a1 Mon Sep 17 00:00:00 2001 From: raventooblue Date: Thu, 2 Jun 2016 12:42:18 -0700 Subject: [PATCH 1/2] Update Game.java I didn't add the coordinates where the mouse click should be in order to start the game because I don't think I can convert correctly --- Game.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Game.java b/Game.java index ea76d9c..1ae7a89 100644 --- a/Game.java +++ b/Game.java @@ -43,7 +43,17 @@ public void init(GameContainer gc) { gc.setTargetFrameRate(60); gc.setShowFPS(false); + //gets mouse input + Input input=gc.getInput(); + int mouseX=input.getMouseX(); + int mouseY=input.getMouseY(); + //updates coordinates when left click + if(input.isMousePressed(input.MOUSE_LEFT_BUTTON)){ + mouseX=input.getMouseX(); + mouseY=input.getMouseY(); + } + try { From f7b08e372803479ac9d0112e92ea4409f6352cf7 Mon Sep 17 00:00:00 2001 From: raventooblue Date: Thu, 2 Jun 2016 13:21:20 -0700 Subject: [PATCH 2/2] Update Game.java I don't know how to do screens also sorry for putting everything in the wrong methods! --- Game.java | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/Game.java b/Game.java index 1ae7a89..ed4a8a5 100644 --- a/Game.java +++ b/Game.java @@ -33,6 +33,11 @@ public class Game extends BasicGame{ Texture t1; + //so we can use them in both the update and render methods + int mouseX; + + int mouseY; + public Game(String name) { super(name); totalTime = 0; @@ -42,17 +47,6 @@ public void init(GameContainer gc) { //This limits the computer processing power cost gc.setTargetFrameRate(60); gc.setShowFPS(false); - - //gets mouse input - Input input=gc.getInput(); - int mouseX=input.getMouseX(); - int mouseY=input.getMouseY(); - //updates coordinates when left click - if(input.isMousePressed(input.MOUSE_LEFT_BUTTON)){ - mouseX=input.getMouseX(); - mouseY=input.getMouseY(); - } - try { @@ -82,6 +76,19 @@ public void update(GameContainer gc, int milli) { if(totalTime/200>1000) { gc.exit(); } + + //gets mouse input + Input input=gc.getInput(); + mouseX=input.getMouseX(); + mouseY=input.getMouseY(); + + //updates coordinates when left click + if(input.isMousePressed(input.MOUSE_LEFT_BUTTON)){ + mouseX=input.getMouseX(); + mouseY=input.getMouseY(); + } + + } public int getStrWidth(String s, GameContainer gc) { @@ -130,6 +137,18 @@ public void render(GameContainer gc, org.newdawn.slick.Graphics g) throws SlickE g.scale(logo.getSize().x/logo.getDesign().getWidth(), logo.getSize().y/logo.getDesign().getHeight()); this.logo.getDesign().draw(centerX-this.logo.getSize().getX()/2, gc.getHeight()/8); g.resetTransform(); + + } + //should check if the mouse has been clicked in the play game rectanble but IDK man + if( (mouseX >= centerX-gc.getWidth()/10) && (mouseX =< (centerX-gc.getWidth()/10)+gc.getWidth()/5) && (mouseY >= + centerY+gc.getHeight()/12) && (mouseY <= (centerY+gc.getHeight()/12)+h)){ + currScreen=1; + } + //game=1 + if( currScreen == 1) { + //create a new background;pretty much just copying the above + + } }