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.

Dark GDK / How do I spawn a sprite and make it Move with the arrow keys?

Author
Message
Skull breaker
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location:
Posted: 1st Sep 2008 18:12
The title says it all.

please help if you can.

This is a signiture
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 2nd Sep 2008 00:48
set up some x and y variables, and then each cycle:
change the variables if keys are pressed
position the sprite with those variables using dbSprite or a similar function.

~you can call me lantz~
Skull breaker
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location:
Posted: 2nd Sep 2008 04:39
well i got the Up and down arrow keys to work but is there a certain way to do the right and left ones?

This is a signiture
Skull breaker
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location:
Posted: 2nd Sep 2008 05:06
ok can u give me some examples on how I would do that?

This is a signiture
Scope 51791
16
Years of Service
User Offline
Joined: 25th Jul 2008
Location:
Posted: 2nd Sep 2008 06:00
It is really simple, simply load the sprite and making X and Y variables by:



Then in the darkGDK loop, you can do if statements for the keys that change the X and Y variables like this:



You then do the same for any other arrow key. Hope I helped.
Skull breaker
16
Years of Service
User Offline
Joined: 29th Aug 2008
Location:
Posted: 3rd Sep 2008 02:39
for some reason wen i use the code u gave me, it moves the character back to the starting point. Can someone give me the full code to make the left and right arrow keys make the sprite go left or right?

This is a signiture

Login to post a reply

Server time is: 2024-09-30 05:35:34
Your offset time is: 2024-09-30 05:35:34