Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8103681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:37:05+00:00 2026-06-05T23:37:05+00:00

I am just playing around with some java programming and so I wanted a

  • 0

I am just playing around with some java programming and so I wanted a picture to move around the screen when I press a key. How ever I get a message saying “Thu Jun 14 13:14:23 EDT 2012 INFO:Controllers not available” this is the code I have for this 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 now if I was to run it like that the object will say in the same spot, but if I only have one of if statements object will move int the direction with out me pressing a key so if I have if(input.isKeyDown(Input.KEY_UP)); {sunY -= 1;} as soon as the app starts the sun moves up and off the screen. What have I done wrong for this to happen?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:37:07+00:00Added an answer on June 5, 2026 at 11:37 pm

    try changing this
    if(input.isKeyDown(Input.KEY_UP)); {sunY -= 1;}
    to this 😀

    if(input.isKeyDown(Input.KEY_UP)) {sunY -= 1;}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just playing around with JSP. I just wanted to test some <jsp:useBean> stuff,
I'm just playing around with some PHP and was wondering what happens when an
Just playing around with some of the APIs in .NET and I can't seem
I was just playing around with some code in LINQPad and managed to crash
I'm just playing around with some code. I create an Activity and simply do
So, I'm just playing around implementing some sorting algorithms in C++, but I'm finding
I'm just learning c++ coming from a Java background. Just playing around with simple
I'm just playing around with some code but it seemed to have the specific
I am playing around some in C++, just for fun. I have just begun
Extremely new to Java an just playing around with it. I'm trying to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.