The Daily Click ::. Forums ::. Klik Coding Help ::. 2 buttons at the same time
 

Post Reply  Post Oekaki 
 

Posted By Message

eyeangle



Registered
  12/06/2003
Points
  1683
25th February, 2007 at 04:44:22 -

No this is not some porno topic.
I've made my custom movement and I'm pretty happy with it. It runs smoothly. However when I press down two directional key buttons at the same time all sorts of weird things happen. Whether it's up and down or left and right. Or all four keys. I suppose the event list starts reading different things at once.
Is there an option that I can turn on that only allows the event list to read the button that is currently being pressed or, even better, read the new button that is being pressed and stop reading the other button that is still be held down???

 
theonecardgame.com

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
25th February, 2007 at 05:10:05 -

The easiest way to fix what you have now is to put some negated key-holding triggers in your movement events.

So:

Repeat while holding Left
---Stuff

becomes

Repeat while holding Left
+[NEGATED]Repeat while holding Right
---Stuff


Something I do sometimes is to have a single group that handles key input, and sets flags for all the other groups to use. No other group has any 'keyboard' triggers at all, they only use the flags set by the input group. By doing this you can have all kinds of custom input logic, like making sure only the most recent of two conflicting key flags are set.

 
n/a

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
25th February, 2007 at 13:58:53 -

Yeah, another idea I like (which is more for combinations of keys though (e.g. fighting games), not holding) is having the text entered into a string. And if the string's text = "ffg" (or whatever) then execute move etc.

Then always reset the string after every x seconds or whatever.

You could implement that in a two buttons at once scenario I suppose, but Radix' answer will most likely worst best in your situation.

 
http://www.SilverNova.co.uk

   

Post Reply



 



Advertisement

Worth A Click