Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java game

Options
  • 11-02-2003 1:18pm
    #1
    Closed Accounts Posts: 1


    i am doing a horse racing game in java and was wondering does any1 know how to move a horse image across the screen at a certain speed using threads. appreciate the help


Comments

  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    IRAman wants to move a horse? Have they dug up Shergar?

    Moving it is the same as the VB Animation thread except for the language used. Change where it's at periodically.

    Work that out first before dealing with the threads.

    When you have that worked out the basic idea is that you create a thread that moves the horse as above and then sleeps for around 40 milliseconds.

    That said with precise animations multi-threading can cause more problems than they solve. For one thing if two different threads of the same nature are doing more or less the same thing it is likely that they will need monitor on the same resources. As such they will have to yield, and the timing goes to ****. It may be better to have a drawing thread that deals with the drawing of all sprites, rather than the (perhaps more obvious) solution of a thread for each sprite.


Advertisement