How do I reset the jump counter for Platform behv.

Get help using Construct 2

Post » Thu Oct 27, 2016 2:57 pm

Hi,

I want to let the player bounce off after a collision. I did use following code.

on collision player with enemy
-> Player -> Simulate control jump

This actually works fine, but however if the player hits the enemy for the third time (and the player haven't touched the ground since then), no jump will be performed.
So is there a way to do following?

on collision player with enemy
-> Player -> Set Jump Counter to 0 (I know there is no action like this)
-> Player -> Simulate control jump

Or has anybody another idea to let the player bounce off from an emeny after collision?

Thank you!
Image Image iTunes: Match3 | Google Play: Match3
B
106
S
39
G
31
Posts: 1,170
Reputation: 29,229

Post » Thu Oct 27, 2016 3:30 pm

I wouldn't do a simulate jump. I would use 'Set Platform vector Y'.
If you use the triggered 'on collision with ..' it should work, otherwise with non-triggered events the player would fly upwards.

Something like: Player| On collision with Enemy -> Player| Set Platform vector Y to 'myJumpStrength'

'myJumpStrength' has to be negative like -650.
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Thu Oct 27, 2016 3:36 pm

Asmodean wrote:I wouldn't do a simulate jump. I would use 'Set Platform vector Y'.
If you use the triggered 'on collision with ..' it should work, otherwise with non-triggered events the player would fly upwards.

Something like: Player| On collision with Enemy -> Player| Set Platform vector Y to 'myJumpStrength'

'myJumpStrength' has to be negative like -650.


That worked perfectly! Thank you!
Image Image iTunes: Match3 | Google Play: Match3
B
106
S
39
G
31
Posts: 1,170
Reputation: 29,229

Post » Thu Oct 27, 2016 4:08 pm

Here is the result :)
https://www.scirra.com/arcade/shooting- ... ypse-11956

Thank you onve again!
Image Image iTunes: Match3 | Google Play: Match3
B
106
S
39
G
31
Posts: 1,170
Reputation: 29,229


Return to How do I....?

Who is online

Users browsing this forum: MadSpy and 8 guests