Jump Forward

Get help using Construct 2

Post » Sun Feb 17, 2013 10:32 pm

Hi


I'm making a platformer with the character using a sword. i'm trying to make the character leap forward (not jump) when a key is pressed (like him to stab the enemy).

I want him to move a certain amount of pixels (whether he's running or not), very, very fast.

So far messing with the max speed and acceleration had yielded no results. Neither have the VectorX. And the "Move" function teleports the player, instead of moving him.

Thanks for any pointers.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Sun Feb 17, 2013 10:42 pm

I assume you're using the custom movement behavior on him? You could do the "Set CustomMovement Speed" and have it go back to normal after that runs for a half-second or however long.
B
20
S
10
G
4
Posts: 106
Reputation: 4,219

Post » Sun Feb 17, 2013 11:37 pm

I wasn't. Thanks for the tip. Will try it out ASAP.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Mon Feb 18, 2013 12:02 am

Now the problem is that it allways jumps straight to the right, regardless of motion.

My guess is that using the platform behavior and the customMovement behavior, I need to bridge information from one to the other, right? (or just use one, but that would be to much work).
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Mon Feb 18, 2013 12:10 am

ooh for some reason I was imagining the dash always going to the right. Could you more thoroughly describe the behavior you're looking for? Is it top-down, or a platformer
B
20
S
10
G
4
Posts: 106
Reputation: 4,219

Post » Mon Feb 18, 2013 12:14 am

also if you link your .capx I might be able to help more. What I've done before when I needed to take control of movement like that was do the "SetCustomSpeed" twice, once for horizontal, and once for vertical, and set each with a formula.
B
20
S
10
G
4
Posts: 106
Reputation: 4,219

Post » Mon Feb 18, 2013 1:23 am

Adagar, thanks for the responses.

I'm trying to do an action platformer. My player is a ninja, and his attack is a swing of his sword. What I'm trying to do is for him to jump in the direction he's facing/running when the attack button is pressed.

So when he's running forward, the attack will leap him forward 200 pixels in 0.2 seconds, inflicting damage to everything in his path.

Later (When I figure how to implement the previous part), when he jumps, and hits the attack button, he will jump 200 pixels in 0.2 seconds in 45 or 90 degrees (inflicting damage to everything in his path).

And later still, he will be able to do that in mid air (so he can dash in any angle including down; in a double-jump fashion.)

perezbalen2013-02-18 01:32:14
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Mon Feb 18, 2013 1:27 am

So far I tried this:

(playerBox has both Platform and CustomMovement behavours)


http://s11.postimage.org/5usx08sxf/code1.png

But the result is that player always jumps forward. And if it was running before the function is called, it stays moving (and I can't stop it) towards the right.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Mon Feb 18, 2013 1:54 am

Using a wait might make everything else stop, I wonder how that would affect stuff like enemy movement...
I'd recommend adding some more logic elements underneath there, I don't have the capx to send you back a screenshot with, but it'd be more like
On PlayerForwardAttack- set lv_currentRunSpeed to PlayerBox.PlatformSpeed
   PlayerBox.velocity>=0- set CustomMovement Horizontal speed to gv_speedAttack
   PlayerBox.velocity<0- set CustomMovementHorizontal speed to -gv_speedAttack
   -Blank-- wait .2 seconds
            set customMovement Horizontal speed to 0

Once your'e done with customMovement Horizontal, setting it back to zero should put platformer back into control

Another thing you could do is give the player character a variable that has his current state stored. You'd set it when he turns left, or jumps, or what have you, and check that state when deciding what to set the customMovement to. For that custommovement speed, use either horizontal or vertical, I don't know what overall is supposed to be for.
B
20
S
10
G
4
Posts: 106
Reputation: 4,219

Post » Mon Feb 18, 2013 2:07 am

Thanks. Settting customMovement Horizontal back to zero did the trick.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Next

Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Lancifer and 25 guests