Footsteps (Running faster and faster)

ZillaZilla Member Posts: 157
edited November -1 in Working with GS (Mac)
I want to simulate the sound of a running player that moves faster and faster.
I want to control the sound of a footstep with a timer that has a variable speed (depending on the elapsed time of the game).

I tried to implement the concept of "How do I have the Timer behavior use variable speeds?" from the Wiki:
http://gamesalad.com/wiki/how_tos:gsc_variable_timer_speed

But it doesn't seem to work the way I made it... Does anybody know of an existing, similar example that I coud download or study?

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    there was another thread about this earlier in the week, and none of us could figure out that tutorial last I read it :)

    What I would do as a simple work around is create a few different rules.

    when speed is < 10
    timer every 1 sec play footstep

    when speed is > 10 and < 50
    timer ever .5 sec play footstep

    when speed is >50
    timer every .25 play footstep

    It's a little more work, and not truly variable, but it should work fine.
  • ZillaZilla Member Posts: 157
    @mulcahy
    Thank you very much :)
    I was using your approach in my last game "Walk The Line":
    http://gamesalad.com/game/play/35111

    There the player runs - and the obstacles appear faster and faster... but only as you suggested within three different ranges...

    I wanted to have the effect a little smoother....
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    it is possible! I was the one with all the problems and finally got it working. It is really useful! I'll find the thread and post it.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I'm uploading it right now. Look for "Timer with Variable Rate" in the shared projects. I can't take any credit for this, but I forget who had the original idea and I couldn't find his project so I just uploaded my copy of it.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    it's up
  • ZillaZilla Member Posts: 157
    @scitunes
    This is exactly what I was looking for :)))

    Thank you very much :)))
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    just paying it forward! It made a huge difference in the game I am working on.
  • rebumprebump Member Posts: 1,058
    For an "every x seconds" timer expression, just make the expression a fraction of the actor's speed. Say if the actor has a max speed of 200, maybe an expression of "(max_speed - current_speed)/100" would suffice. This would give the actor a footstep repeat of every two seconds when barely moving and down to every one hundredth of a second at a speed of 199.

    Since low around zero and including zero would include a footstep and in the upper range the footstep may come too quickly (for performance too), you would want to handle a speed of zero (or even a small lower range that includes zero) and a speed of 200 (or even a small upper range that includes 200) separately.

    Adjust the "/100" piece to vary it up a bit. You could even play with "log10()" and "ln()" to make the adjustment less linear. You could also use "min()" or "max()" to play with the lower and upper ranges a bit. You could also play with the equation itself using something that maybe fits your needs better. Open up a spreadsheet program and make a table of the values and any equations or sub-equations to see what you can come up with.

    Also, you could make the footstep sound either a one-step or a two-step sound to fit your equation better.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    rebump, was this your original solution? I think it was, right? Some reason I couldn't find your original project in shared. Maybe, I just over looked it.

    good suggestions here for how to spice it up!

    Thanks, again! I am putting out a jumping game soon and all of the moving actors use this to make the game get harder and harder so it was really key!
  • ZillaZilla Member Posts: 157
    @scitunes
    Your example works like a charm :)

    @rebump
    Thank you very much for your ideas: I love math :) Especially in a game engine like GS where you spend most of your "coding" by clicking through behaviours...
  • rebumprebump Member Posts: 1,058
    @scitunes: Nope, wasn't mine and was unaware of one being out there. I actually typed most of that up and then got sidetracked by my toddler before sending. If I would have been sidetracked earlier, I probably would have seen your responses since that time and not replied. :-)

    Oh well. Maybe it is similar to what you presented maybe not. Either way...the more info out there, the better.

    @Zilla: I like math too. Too bad it has been decades since I took any math courses in college. If I get into this more and more, I may go take a class or two to refresh. :-)
Sign In or Register to comment.