Double tap system?

For questions about using Classic.

Post » Wed Jun 22, 2011 4:38 am

Hello,there,people from the Scirra Fellowship xD.
I'm having troubles trying to set up a "double tap" system for my game.
I founded some references and old posts of people who resolved this before,but they're old and
All hte download links are broken/deleted...Can someone please give me a little hint on how to set up this?

Thanks in advance!_(-_-)7
B
3
S
1
G
1
Posts: 4
Reputation: 840

Post » Wed Jun 22, 2011 5:16 pm

I admit, I'm not familiar with the term "double tap", so I had a look at wikipedia, which stated that it is something like a rapid double shot.

If it is meant to trigger once but shoot twice within a certain timespan, than you can do it this way:

var 'double' - 0 for single shot, 1 for double
var 'time' - timespan between first and second shot in milliseconds
var 'timestamp' - (make this a private var to the bullet object, initially 0) the moment when the first shot is activated

+ some condition that activates double shot
-> 'double' = 1

+ key for shooting pressed
-> spawn bullet
++ if 'double' == 1
--> bullet('timestamp') = timer

+ bullet('timestamp') > 0
++ bullet('timestamp') <= timer - 'time'
--> spawn bullet
# not from this bullet but from the player!

If this isn't what you're looking for, please ignore or explain in detail :)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Jun 24, 2011 1:23 pm

My request was for a "double click" style ,like in a fighting game,when you "duoble tap" the direction stick to run,or make a fast jump.
B
3
S
1
G
1
Posts: 4
Reputation: 840

Post » Fri Jun 24, 2011 3:21 pm

Kinda the same concept.


+on "tap" pressed

(sub event) +value "tap timer" is lower or equal to 0
-set value "tap timer" to 30

(sub event) +value "tap timer" is greater than 0
-add your double tap actions here

+value "tap timer" is greater than 0
-subtract 60*timedelta from value "tap timer"



...or something like that.
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Jun 25, 2011 2:27 am

[quote="Tokinsom":2dcitum5]Kinda the same concept.


+on "tap" pressed

(sub event) +value "tap timer" is lower or equal to 0
-set value "tap timer" to 30

(sub event) +value "tap timer" is greater than 0
-add your double tap actions here

+value "tap timer" is greater than 0
-subtract 60*timedelta from value "tap timer"



...or something like that.[/quote:2dcitum5]

Thank you very much,Tokinsom!It worked perfectly ! :D
B
3
S
1
G
1
Posts: 4
Reputation: 840

Post » Sat Jun 25, 2011 5:37 am

[quote="tulamide":8z3z1xp6]I admit, I'm not familiar with the term "double tap", so I had a look at wikipedia, which stated that it is something like a rapid double shot.[/quote:8z3z1xp6]

I'm pretty sure what you got was about the hollywood hitman-lingo, where double-tap means to shoot the target in the head twice, "just to be sure". =P

I'm pretty sure what he was thinking about was where instead of having a run button, you simply press left or right twice quickly and keep the button pressed after the second to make and keep the character running. ^^
B
73
S
20
G
10
Posts: 524
Reputation: 9,896


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests