Having a little logic problem [Solved]

IceboxIcebox Member Posts: 1,485
edited October 2015 in Working with GS (Mac)

Hello guys , my issue is regarding a platformer game , I have a sound playing every time the player lands on ground , so when my feet on ground is true , play landing sound.

It works pretty well , but im having an issue of the landing sound playing when i start the level , the problem is that the hero actor is already on the ground , so the landing sound plays automatically once at the start of every level. I am trying to figure out a way to make it trigger the sound rule only after i jump and land on ground or when i fall on the ground, but i cant figure out a good way to do it.

These are my two rules

Rule 1

If actor collides with ground
change game.myfeetonground to true
Otherwise change game.myfeetonground to false

Rule 2

If game.myfeetonground is true
play landing sound

Thanks

Comments

  • ArmellineArmelline Member, PRO Posts: 5,421

    Might be able to fix it with a simple "If self.Time > 0.1 then" condition added to the collide with ground rule.

  • IceboxIcebox Member Posts: 1,485
    edited October 2015

    @Armelline this would just make it trigger after 0.1 seconds,whatever i put in as soon as my feet on ground is true it will play, and my feet on ground needs to always be true when the actor collides with the ground.

  • SocksSocks London, UK.Member Posts: 12,822

    Whatever method you are using to get the actor off the ground should have a gate that allows the feet on the floor sound to work . . .

    So:

    When Actor jump is true change AAA to true

    If actor lands on ground and AAA is true - then play sound.

  • IceboxIcebox Member Posts: 1,485

    @Socks Thanks , it worked and thanks @Armelline

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @Socks said:
    Whatever method you are using to get the actor off the ground should have a gate that allows the feet on the floor sound to work . . .

    So:

    When Actor jump is true change AAA to true

    If actor lands on ground and AAA is true - then play sound.

    Clever.

Sign In or Register to comment.