Click to See Complete Forum and Search --> : moving a pic around the screen


IRON_NOODLE
03-12-2003, 05:47 PM
hey can some1 help me out here, im making a game and am wondering if some1 can help me with the coding to put an image on the screen then when u press "e" it moves the image up, "s" to the left, "d" down and "f" to the right

khalidali63
03-12-2003, 05:53 PM
I am sure you will figure it out here is the first light of knowldge though...

:D

get image reference using

var img = document.getElementById("imgId")

then set its top and left values every time "e", "s" .... are pressed

img.style.top = new value+"px"
img.style.left = new value+"px"

I hope this helps

Cheers

Khalid

IRON_NOODLE
03-15-2003, 01:32 PM
ok im sry but i dont understand that at all can some1 just reply with the code if its not too much trouble

khalidali63
03-15-2003, 01:58 PM
I am not sure If I can do a complete code for you today,Hope some one else can.
I'll probably be able to do it on monday,If you have not found the solution for you by then.

Cheers

Khalid