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 / Movement codes

Author
Message
BobaJoe
14
Years of Service
User Offline
Joined: 15th Nov 2009
Location:
Posted: 16th Nov 2009 01:28
I'm trying to make A and D move a sprite with A being left and D being right.
This is my code put it doesn't work.

if(dbKey()== 1 )
{
dbRotateSprite(3,90);
dbMoveSprite(3,-3);
dbRotateSprite(3,0);
}

if(dbKey()== 1 )
{
dbRotateSprite(3,90);
dbMoveSprite(3,3);
dbRotateSprite(3,0);
}

thanks for your help.
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 16th Nov 2009 06:31
Err try dbKeyState ( int iScanCode ) ;. Your code isnt even checking what key is pressed as far as i can tell. Also your code isnt moving the sprite as far as i can tell just merely settings the position. Is this for 2D or 3D?
Aldur
16
Years of Service
User Offline
Joined: 8th Oct 2007
Location: Melbourne, Australia
Posted: 16th Nov 2009 06:40
For the 'A' key it is


and for the 'D' key it is


Should do the trick
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 16th Nov 2009 13:02
or include dinput.h and use DIK_* if you don't have the scan code, like < dbKeyState ( DIK_A ) ) >

BobaJoe
14
Years of Service
User Offline
Joined: 15th Nov 2009
Location:
Posted: 17th Nov 2009 02:39
I'm new to this so can you give me an example.
or change my coding so it would work.
thanks

Login to post a reply

Server time is: 2024-10-01 18:33:08
Your offset time is: 2024-10-01 18:33:08