The Daily Click ::. Forums ::. Klik Coding Help ::. stupid issue with the joypad object...
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
6th February, 2015 at 06/02/2015 19:12:37 -

so i have it so you can play my game with keyboard and with a joypad. the issue im having is my double tap to dash works great for keyboard, but will not work with the joypad, the joypad instantly dashes. the way it works is when a key is pressed for the first time after standing it adds to an alterable value that is deduced over time, if the button is hit again while the counter is above zero it increases maximum x velocity. again, this works perfectly with they arrow keys, but the second i try to do it with a joypad he insta-dashes. any ideas how to get around this?

 
[Game design makes my brain feel like its gonna explode.]

Airflow

imafirinmahlazr

Registered
  24/09/2003
Points
  -197

VIP MemberSonic SpeedSnow Cloud!Computer
11th February, 2015 at 11/02/2015 13:59:08 -

hi siven. the problem lies in the behaviour of the joypad button. It will return true whenever the button is held. So if the button is pressed for say 5 frames (10th of a second) the event will trigger 9 times, because the first time it set the value to 300 or something. I hope this helps.

 
n/a

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
22nd February, 2015 at 22/02/2015 19:35:16 -

thats what i thought was happening. is there a way around this??

 
[Game design makes my brain feel like its gonna explode.]

Airflow

imafirinmahlazr

Registered
  24/09/2003
Points
  -197

VIP MemberSonic SpeedSnow Cloud!Computer
23rd February, 2015 at 23/02/2015 02:10:10 -

yes actually, there's a variety of ways. For a rapid double tap detector, you naturally need a variable.
Combine this with flags and you will be fine.

Here are events for a simple button, without the double tap detection:
condition (flag0 off) && button pressed - > set flag 0 on, set flag 1 on
condition (flag0 on) && button not pressed -> set flag 0 off, set flag 1on
for button pressed once:
condition (flag0 on, flag 1 on) -> do things, set flag 1 off

This works because the button event is a constant stream, but the 2 main events can only trigger once due to flag 0. Flag 1 separately allows a single use per button state change.

That took some thinking,

 
n/a

nim



Registered
  17/05/2002
Points
  7234
23rd February, 2015 at 23/02/2015 14:17:03 -

Have you tried simply adding a "Only one action while event loops" condition? Sorry that might sound too simple but worth trying if you haven't. I'm sure this can be solved. Are you using an extension for joypad controls?

 
//

Airflow

imafirinmahlazr

Registered
  24/09/2003
Points
  -197

VIP MemberSonic SpeedSnow Cloud!Computer
24th February, 2015 at 24/02/2015 09:37:22 -

Aw nim how can I scare him if you make click coding look so easy?

 
n/a
   

Post Reply



 



Advertisement

Worth A Click