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

0 favourites
  • 6 posts
From the Asset Store
25 high quality isometric ground blocks + sprite sheet
  • 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?

  • Try Construct 3

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

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

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