How do I make actions occur only when on the ground.

Get help using Construct 2

Post » Wed Jan 25, 2017 1:34 pm

Ok so I've got a game that's like a cross between break out and a platformer, and whenever you lose a ball, the player charecter throws a new ball to keep the game going. This is what I'm currently using to do it.
Image
It works fine for the most part as long as you're currently standing on the ground, if you lose a ball when you're jumping or anything other then standing on the ground though it cancels out the action. So I'm wondering how I can make the action play out like next time you touch the ground?
B
6
Posts: 7
Reputation: 264

Post » Wed Jan 25, 2017 4:43 pm

You can probably use the Platform behaviour check 'Is On Floor' for this.
B
45
S
15
G
73
Posts: 2,021
Reputation: 43,424

Post » Wed Jan 25, 2017 4:58 pm

So I'm wondering how I can make the action play out like next time you touch the ground?


Give the player sprite a instance boolean variable. say 'aCtion'.

Set that boolean to true when the 'action' happens. Now the player sprite 'knows' that 'it happened'. Just have to wait till he hits the floor to start that animation. So ....

Player > platform > On landed
...................... set 'aCtion' to false
...................... do that animation thing
B
33
S
18
G
28
Posts: 2,474
Reputation: 20,912

Post » Thu Jan 26, 2017 2:18 am

Message: Shambrook can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
Ok when you say set the boolean after the action you mean when the ball is destroyed right?

I tried this
http://imgur.com/z72xJWC
And it's stopped my ball respawn thing all together.

I've also tried checking for the variable value with the condition 'player is on floor' instead of landed, it keeps the respawn going like it was before, but still if I'm in the air when the ball dies, it doesn't play out the next time I hit the floor.
http://imgur.com/CECwvDY
B
6
Posts: 7
Reputation: 264

Post » Thu Jan 26, 2017 9:46 pm

Darn, yes, you have 2 situations.

- ball is destroyed when in air ... wait for landing .. then respawn
- ball is destroyed when not in air ... just respawn ... (no idea if you have a timer)

On ball destroyed
........action .... set players Boolean 'aCtion' to 'true'

Player Is on floor
Players is Boolean 'aCtion'
____action ....respawn
......................set players Boolean 'aCtion' to 'FALSE'
B
33
S
18
G
28
Posts: 2,474
Reputation: 20,912

Post » Thu Feb 09, 2017 2:33 pm

Message: Shambrook can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
So I ended up getting this working, the boolean thing was a huge help but I ended up setting a Boolean value for weather I was in the air or not as well as a boolean for weather the ball was destroyed.
Ended up coming up with this and it works great
http://imgur.com/71kGNOm

thanks for all your help.
B
6
Posts: 7
Reputation: 264


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], lolsuperscratch, RobertMKD, tarek2 and 10 guests