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.

Newcomers DBPro Corner / help with input

Author
Message
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 25th Jul 2007 04:11
i have been searching hte forumns all week. and I still need help with the most basic problems. and now i need help with input. basicly i'm trying to code the game like this.

1 = high punch
2= low punch
etc. what i need some one to help me is with the code to get the came to respond when a key is pressed. and please explain it to me in simplest terms. i am not a programer but i am trying my best.

wind
Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 25th Jul 2007 04:33
You need to use Keystate(scancode)


Heres a great example from DBP. Compile it and press any key it will tell you the scancode.

So it would be like if keystate(scancode)=1 then do this...


Load Programmer "Crazy Programmer",1
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 25th Jul 2007 05:33
no i still don't need it can someone please break out darkbasic and show me a simple example of input. i'm new and I'm trying not to hit the monitor.

wind
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 25th Jul 2007 05:33
I appreicate all of you taking the time to read my many post and answer my questions but i need simple examples.

wind
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 25th Jul 2007 05:39
try this mate



this tells the computer that if the "1" key is pressed then it will do the code you put between "if" and "endif"

for the "2" button you would have



The reason I haven't used "if keystate(1)=1" is because the number that goes in the "()" is the ID of the key on your keyboard, so for example "1" is escape "2" is 1 "3" is 2 etc...

Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 25th Jul 2007 05:42 Edited at: 25th Jul 2007 05:45


Does that help?

edit: Kieran beat me to it. I didnt refresh the page


Load Programmer "Crazy Programmer",1
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 25th Jul 2007 05:48
hey crazy programmer thank you so much for taking this time to help me. I wish their was something I could do to pay you back, but i'm not that good at programming. and i completly forgot that each key has its own code.

wind
Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 25th Jul 2007 06:01
No problem, we were all there at one point in time. Are you using the DBP trial or do you own DBP? If you own DBP look around in the help files. Theres alot of examples.


Load Programmer "Crazy Programmer",1
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 25th Jul 2007 11:29
Ummmm your welcome? (if you enjoyed my code that is)

Login to post a reply

Server time is: 2024-11-26 12:49:13
Your offset time is: 2024-11-26 12:49:13