image - isKeyDown not working in Java -


i playing around java programming , wanted picture move around screen when press key. how ever message saying "thu jun 14 13:14:23 edt 2012 info:controllers not available" code have page

public class menu extends basicgamestate {     image sun;     int sunx = 200;     int suny = 200;      public void init(gamecontainer gc, statebasedgame sbg) throws slickexception     {         sun = new image("res/sun.png");     }      public void render(gamecontainer gc, statebasedgame sbg, graphics g) throws slickexception     {         g.drawimage(sun, sunx, suny);     }      public void update(gamecontainer gc, statebasedgame sbg, int delta) throws slickexception     {         input input = gc.getinput();         if(input.iskeydown(input.key_up)); {suny -= 1;}         if(input.iskeydown(input.key_down)); {suny += 1;}         if(input.iskeydown(input.key_left)); {sunx -= 1;}         if(input.iskeydown(input.key_right)); {sunx += 1;}     } } 

right if run object in same spot, if have 1 of if statements object move int direction out me pressing key if have if(input.iskeydown(input.key_up)); {suny -= 1;} app starts sun moves , off screen. have done wrong happen?

try changing if(input.iskeydown(input.key_up)); {suny -= 1;} :d

if(input.iskeydown(input.key_up)) {suny -= 1;} 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -