Author Topic: Give the ego footstep sounds  (Read 10657 times)

0 Members and 1 Guest are viewing this topic.

Offline gumby

Give the ego footstep sounds
« on: September 16, 2012, 05:27:49 PM »
Here's how to do it, using the SNDBLAST or MTBLAST drivers.  I created 4 separate WAV footstep sounds & appended them to 4 empty sound resources.  Then in the room script, I added a doit() method which basically checks the current loop of the ego.  On two of the cells, we trigger a random sound playback of one of the footsteps.

Code: [Select]
(local
     currentCel
     previousCel
     loop
)

...

(method (doit)
(var randomSound)
        = currentCel (send gEgo:cel)

        (if (<> currentCel previousCel)
            = loop (send gEgo:loop)
            = randomSound Random(0 3)
 
            // ego is walking horizonally
   (if(== loop 0 or == loop 1)
      (if(== currentCel 0 or == currentCel 4)    
   (send gTheSoundFX:
           prevSignal(0)
   stop()
   number(randomSound)
   play()
   )
)
    )

   // ego is walking vertically
   (if(== loop 2 or == loop 3)
      (if(== currentCel 3 or == currentCel 0)    
   (send gTheSoundFX:
  prevSignal(0)
  stop()
          number(randomSound)
  play()
    )
       )
   )
)
= previousCel currentCel
)
I did have to make a modification to the ego view in the template game.  The 'vertical' animations (the ones where the ego is walking toward/away from you) only had 5 cells, which made the ego sound like he was hobbling.  I added an additional cell to each loop which worked, but the result is that the ego appears to be dancing.  Quite humorous.

I've uploaded the demo (with source code) to the fan games section.
« Last Edit: September 17, 2012, 05:41:28 PM by Cloudee1 »


In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Give the ego footstep sounds
« Reply #1 on: September 16, 2012, 09:50:41 PM »
It doesn't seem to be showing up, yet. Are you going to add this to the Wiki, too?
« Last Edit: September 16, 2012, 09:53:43 PM by Collector »
KQII Remake Pic

Offline gumby

Re: Give the ego footstep sounds
« Reply #2 on: September 16, 2012, 11:58:27 PM »
Yes, it's now added to the wiki.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Cloudee1

Re: Give the ego footstep sounds
« Reply #3 on: September 17, 2012, 05:42:59 PM »
Amusing... the game can be downloaded now. I've gone ahead and added a link in your original post to the game. Almost sounds like he's running when the player moves north and south. But neat either way.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline gumby

Re: Give the ego footstep sounds
« Reply #4 on: September 17, 2012, 09:16:07 PM »
Yeah, the problem is the different number of cells, 8 vs 6.  Probably the correct way to do this is to have 8 cells for the north/sound animations too.  But then I'm guessing that the ego would appear to walk too slowly based on the amount of distance traveled on the screen.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.058 seconds with 22 queries.