Looped steps sounds

  • I wanted to make the player hear the sound of steps when:

    - he touches a particular ground

    - and when he is moving.

    I have arranged such an event, but the effect is that I can hear a lot of overlapping footsteps sounds.

    Variable "footsteps_speed" is used to adjust the interval between steps.

    I thought the system was playing sound and waiting to play sound again, if of course the conditions are met.

    I think I miss something here. I will be grateful for every hint.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What you are getting is the "machine gun effect". Wait doesn't effect when overlapping happens so this event is triggering 60 times per second.

    footstep_speed needs to be in the Event

    EVENT: 
    Is overlapping
    Bullet_speed > 0
    AND footstep_elapsed_time <= 0
    
    ACTION: play sound
    ACTION: set footstep_elapsed_time to X
    

    then in a separate event make:

    EVENT:
    if footstep_elapsed_time > 0 
    ACTION: 
    Subtract dt from footstep_elapsed_time
    

    Or another way is to say... do this Event as long as this Tag"footstep" is NOT playing, but I would assume you'd maybe want some overlap? conceivably all your footstep sounds are not the same length.

  • A common misconception is the "Wait" action doesn't pause all events in the event sheet (it wouldn't be very useful if it did). It really means "schedule the rest of this event to run after a delay". Meanwhile the event is continually true so the sound continually keeps playing (and scheduling the rest of the event to run after a delay, but that does nothing because there are no more actions).

    I think an easier way is just to add "Every footstep_speed seconds" condition.

  • Thanks Jobel and Ashley!

    I took what Ashley suggested:

    "I think an easier way is just to add "Every footstep_speed seconds" condition."

    It is beautiful and simple and works perfectly!

    Also thanks for explaining the wait concept.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)