Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2D movement isn't working! HELP PLEASE!

Author
Message
SnowBoardin360
14
Years of Service
User Offline
Joined: 29th Nov 2009
Location:
Posted: 2nd Feb 2010 20:15 Edited at: 2nd Feb 2010 21:58
Movement will not work. this is my code.


sync on
sync rate 60

hide mouse

load image \"C:\\Users\\Brett\'s\\Desktop\\Axe.bmp\", 1
sprite 1, 170, 1, 1

DO
if upkey()=1 then y=y-1
if downkey()=1 then y=y+1
if leftkey()=1 then x=x-1
if rightkey()=1 then x=x+1

sync
LOOP
end



this also doesn\'t work

sync on
sync rate 60

hide mouse

load image \"C:\\Users\\Brett\'s\\Desktop\\Axe.bmp\", 1
sprite 1, x, y, 1

DO
if leftkey()=1 then inc x +1
if rightkey()=1 then dec x -1

sync
LOOP
end


AND


sync on
sync rate 60

hide mouse

load image \"C:\\Users\\Brett\'s\\Desktop\\Axe.bmp\", 1
sprite 1, x, y, 1

DO
if leftkey()=1 then inc x
if rightkey()=1 then dec x

sync
LOOP
end


AND i\'ve tried moving the sprite to after the rightkey and it didn\'t work. help please.

You don't fight war for your contry, you don't fight war for your Queen, you fight war for the person beside you.
SnowBoardin360
14
Years of Service
User Offline
Joined: 29th Nov 2009
Location:
Posted: 2nd Feb 2010 22:53
fixed

You don't fight war for your contry, you don't fight war for your Queen, you fight war for the person beside you.
Tobo
18
Years of Service
User Offline
Joined: 12th May 2005
Location:
Posted: 3rd Feb 2010 21:49
For those still scratching their heads, and as Mr SnowBoard didn't explain his 'fixed', it helps if you draw the sprite inside the DO / LOOPs.
Non Sequitur M
15
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 30th Apr 2010 02:22
First of all people, please, PLEASE, use the code tag! It's awful to come into a thread, wherein someone isn't using them! You can easily decrease the size of your posts by anywhere from 5-95%!

Secondly, Tobo, his other problem is this:

Am I correct? And, he has his sprite moving left when right is pressed, and vise versa(Although this is trivial).

Other wise, that's pretty much how you do it...

If life were like a box of chocolates, I'd know what I would get... The one that got dropped on the floor and put back in the box.

Iye nehvur yoose spehl chehk, ahn mie tippyng izz fiyne.

Login to post a reply

Server time is: 2024-04-20 13:34:27
Your offset time is: 2024-04-20 13:34:27