How do I set multiple inputs conditions?

Get help using Construct 2

Post » Tue Sep 09, 2014 4:10 am

Hello everyone, here's the problem i face:

If you have a character who should move like
On [UP pressed (once and release)] he moves to last mouse position like and rts (or do certain action)
On [UP pressed twice] he dash to mouse position (or do a different action)
On [UP held down] he follows the mouse position as long as you keep pressing UP.

The player should move mainly by holding up a button. But should be able to dash by double tap the same button or move automatically to mouse position if a single tap of this same button is pressed.


The first two events works fine together, (thanks to some helping people here), but the last one, holding a button to do something it's giving me a headache.
I can make the three work simultaneusly but if i relase the held button to stop it's action, (pursuing the mouse position in this case), it paralyze the others movement events too.

So the deal is how to use the same button to do 3 different actions depending if you hold it, press it once or double tap it.
Specially taking into account that releasing the held button to stop its actions breaks any of the rest inputs types.

Here is a quick capx with the 3 movement conditions and the held button not stoping the player no matter what i try.

https://www.dropbox.com/s/23uof75u5u2y7 ... .capx?dl=0

I need help on this. I have no more brain left...
Thanks in advance and to those that created the template i use here ;)
B
31
S
4
G
4
Posts: 110
Reputation: 4,593

Post » Tue Sep 09, 2014 12:16 pm

I had a look at your capx but I can't see what the problem is. It seems to be doing what you want. What do you mean by "it paralyzes the other movement events"?
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,680

Post » Tue Sep 09, 2014 12:58 pm

As ramones said, there doesn't seem to be issue with your control scheme.

On the other hand though, the "player" will block when reaching the limit of your layout (as it is bound to layout). As you "Scale outer" your project, on a 1920 wide screen it gives the impression that the player won't move into the last right 1/4 of the screen. It's because it's actually out of the "Playzone".

Is that actually your issue ?
You can experience it better by delimiting your playzone with a sprite. See the attached capx (made in r179, link at the bottom of the page)
You do not have the required permissions to view the files attached to this post.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
295
S
118
G
96
Posts: 7,327
Reputation: 71,246

Post » Tue Sep 09, 2014 3:05 pm

Sorry if my problem wasn't clear. Here goes more info:

If you play a little with the capx demo you will start moving your player while you keep pressing "D". It will follows the mouse cursor but if you release the button the character won't stop. It will go loose.

If i try to stop the character by setting it's bullet behavior to Speed 0 or disable it then the others movements also won't work. Like the single tap for the player to go to mouse position as in usual rts fashion.

So basically i don't know how to stop the "On D is down" movement without stoping the ability to move with the other two methods (single tap and double tap).
Should be easy i guess. I missing something very basic here but i'm out of ideas.

PD:
I didn't touch much the boundaries of the map because i was just showing the inputs methods and how they behave.

Thanks to show interest helping me out.
B
31
S
4
G
4
Posts: 110
Reputation: 4,593

Post » Tue Sep 09, 2014 3:31 pm

Gotcha. If you create a new event with "On D released" and "Group Dash is NOT active" then "set speed to 0", it should only affect the hold movement.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,680

Post » Tue Sep 09, 2014 6:25 pm

Holy sh.. you! That's was it! Works fine now.
Thanks @ramones ! I was using your example from another topic all along but didn't remember who made it. And you came back to finish what you started!

Epic stories apart i'm going to test this with all input devices to see if it works fine with all of them (mouse, gamepad, touch, etc). But i guess this solves all issues.

Thanks @Kyatric for your help too!

PD: This is the topic from where i took @ramones example.
https://www.scirra.com/forum/double-touch-like-double-mouse-click_t70460?&hilit=double+tap

This is the latest Capx with all three control schemes working fine together:
https://www.dropbox.com/s/23uof75u5u2y7 ... .capx?dl=0

Cursor sprite don't align correctly to mouse position but that's outside the scope of this example. I'm looking into this error.
B
31
S
4
G
4
Posts: 110
Reputation: 4,593


Return to How do I....?

Who is online

Users browsing this forum: dop2000, jatin1726, max2612 and 4 guests