The basic question

O.k how do you make something move on the screen? ??? I have been trying so hard to get this right and have looked at many different ways but none of them seem to work properly or just do not work at all. I know you have to redraw the image when you want it to move but how can i do this? I have looked on every tutorial here but they don’t give much detail about why they put that peice of code there. So please can some one help me?

http://www.cokeandcode.com/info/tut2d.html

Nope doesn’t really help it tells you in parts which is confusing for me. All i want to know is a good peice of code that makes a square move up and down on the screen. The rest il figure out when i come 2 it.

the game:

declare variables
make a buffer
load stuff

run as long as it makes sense

clear the buffer (or don’t)
change variables accordingly to the input flags (logic)
draw the background on the buffer
draw the sprites on the buffer
draw the hero on the buffer (using those variables)
draw other stuff on the buffer
draw the buffer on the screen

repeat


in the input handler:

if key ‘x’ is down set the flag to 1
if key ‘x’ in not down set the flag to 0
if key ‘esc’ is down set “makes sense” to false :wink:


That’s the whole idea. Of course you need to know how to programm in java - otherwise you won’t be able to do much.

Things don’t really “move.” You just change their position a little bit every frame.

Basically, just set the x and y position of it to somewhere onscreen, then increment it every loop.

The webpage he gave seems simple enough. Just scroll to the movement section and it bascially puts it right there.

Every sprite has an x and y position variable, and you use that to tell it where to draw it at, then you change that variable when the loop restarts, so it appears to move.

yeah i know things don’t move thats what i said in 1st post. I’ll look at it again, i hate reading from my computer screen my eyes go funny. I need a TFT monitor (off topic :-X).