0 Favourites

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

  • 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.

    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?

  • You can probably use the Platform behaviour check 'Is On Floor' for this.

  • 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

  • Ok when you say set the boolean after the action you mean when the ball is destroyed right?

    I tried this

    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.

    imgur.com/CECwvDY

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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'

  • 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

    imgur.com/71kGNOm

    thanks for all your help.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 14,485
DMT2005's avatar
DMT2005
Unread sticky
1 Favourites
C2 Games made with CocoonIO
136 89,808
minhcuong's avatar
minhcuong
Unread hot topic
99 10,126
karshinkoff's avatar
karshinkoff