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 / confuse with dbDownKey>,<

Author
Message
kwakwa
14
Years of Service
User Offline
Joined: 11th Dec 2009
Location:
Posted: 11th Dec 2009 12:53


why my dbDownKey so weird???

I have a pict with 3 menus, my position now at menu 1, I want to go to menu 2 when I press DownKey, but, when I press DownKey, my position now at menu 3.. why??? I think the DownKey look like looping forever...Please help me..T_T.. and whad solution for input from user?? keystate?? or what?? thx
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 11th Dec 2009 13:49
best way to get input is:


replace the * with the key, for example:



DIK_*
* can be from A-Z, 0-9, and much more, you can see dinput header for more, or you can type :IK_ and see the global scope.

Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 11th Dec 2009 20:45 Edited at: 11th Dec 2009 20:46
What's happening is your program is looping through the main 'while' loop many times per second. dbDownKey() does not pause anything, so when you press it, p gets increased by 1 - to 2. Then it executes this:


It does that once, and then (faster than you can be able to take your finger off of the down key) loops and returns back to dbDownKey(). Again, barely any time has passed, so your finger is still on the down key, and it increases p by 1 and loops again and again until you take your finger off of the down key.

What you need to do here is to check whether or not the down key was pressed the loop before. To do this, simply store the down key's state in an int or a bool.

ex.


Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
kwakwa
14
Years of Service
User Offline
Joined: 11th Dec 2009
Location:
Posted: 13th Dec 2009 01:32 Edited at: 13th Dec 2009 10:32
@Hassan
I have try your solution..but I have the same problem..the keystate loop forever..can I stop the loop??

@Bran flakes91093
Your solution is success..when I press DownKey my menu stop at menu 2..BUT..when I try to DownKey again..that's stuck..can read


I'm very stress with GDK>,<..

Can you make for me the good code for my problem??
I have this Image..





my menu now at Single Player, when I press Down, I can change image to Multiplayer, when I press Down again, I can change to HighScore..next..until Exit..please help me..this is my school project..and I can't do anything until now..T_T..

Attachments

Login to view attachments
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 14th Dec 2009 17:08 Edited at: 14th Dec 2009 17:09


Isocadia
15
Years of Service
User Offline
Joined: 24th Jul 2009
Location:
Posted: 14th Dec 2009 17:42
From what I get out of your very clear message, is that the moment you get to exit, and you press down you don't go up to singleplayer. It's fairly easy done, in de same if statement where you go down, before you move down check if it is on exit. if it is go back to 1, if it is not add 1.

Isocadia

Code:

Login to post a reply

Server time is: 2024-10-01 20:27:10
Your offset time is: 2024-10-01 20:27:10