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! / image facing the arrow key you press?

Author
Message
Zeus
19
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 3rd Apr 2007 03:54
this is something that has confused me. here are the image files.

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 3rd Apr 2007 04:56
JSG,

You need to show some effort on your behalf, posting someone else's graphics and expecting code is a little long winded.

here is some theory

create a variable called direction

1 equals up
2 equals right
3 equals down
4 equals left


direction = 1


then in your key management in your main loop simply apply the key to the direction

if upkey()=1
direction = 1
endif

...


if leftkey()=1
direction = 4
endif

then later in your main loop after the check for keys update the players sprite with the direction

if direction = 4
rem move sprite left however many units.
endif

Zeus
19
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 3rd Apr 2007 14:35
Thanks indi.

Login to post a reply

Server time is: 2026-07-05 22:58:33
Your offset time is: 2026-07-05 22:58:33