Jump to content


Photo

How to make a footstep when i walk


  • Please log in to reply
5 replies to this topic

#1 Catsia

Catsia

    GMC Member

  • New Member
  • 23 posts

Posted 12 October 2011 - 11:21 PM

So I am working on a game for one of my friends and I tried everything I can to make a footstep sound when the player walks but the sound goes rapidly instead of single. And Yes I am using controls W,A,S,D. But A and D are left out.
  • 0

#2 filulilus

filulilus

    GMC Member

  • GMC Member
  • 928 posts
  • Version:GM:Studio

Posted 13 October 2011 - 08:56 AM

Set up a trigger and a alarm[] or self made timer.

e.g:

CREATE:
play_sound = 1

STEP:
if play_sound = 1 {
alarm[0] = 30
play_sound = 0
//play sound
}

ALARM[0]:
play_sound = 1
  • 0

#3 Catsia

Catsia

    GMC Member

  • New Member
  • 23 posts

Posted 13 October 2011 - 01:05 PM

Set up a trigger and a alarm[] or self made timer.

e.g:

CREATE:
play_sound = 1

STEP:
if play_sound = 1 {
alarm[0] = 30
play_sound = 0
//play sound
}

ALARM[0]:
play_sound = 1

Actually, It's multiple step sounds, but I'll just try this for fun until I get a response.
  • 0

#4 Catsia

Catsia

    GMC Member

  • New Member
  • 23 posts

Posted 13 October 2011 - 02:18 PM

Set up a trigger and a alarm[] or self made timer.

e.g:

CREATE:
play_sound = 1

STEP:
if play_sound = 1 {
alarm[0] = 30
play_sound = 0
//play sound
}

ALARM[0]:
play_sound = 1

Actually, It's multiple step sounds, but I'll just try this for fun until I get a response.
Wait it's Not Working! D:
  • 0

#5 BattleRifle BR55

BattleRifle BR55

    Moo

  • GMC Member
  • 8247 posts
  • Version:GM7

Posted 13 October 2011 - 09:28 PM

This isn't 3D-related, so please keep questions like this in the Novice Forum.

To add onto filulilus's answer, try this. In your movement code, make an alarm activate after a second or so. Then -

Alarm[0]

if (point_distance(x,y,xprevious,yprevious) > 0)
{
    sound_play(choose(footstep1,footstep2));
    alarm[0] = 30;
}

  • 0

#6 Rarity

Rarity

    GMC Member

  • New Member
  • 2 posts

Posted 13 October 2011 - 09:57 PM

Here is a complex version I use, you will have to tweak it for your own game however.

alarm[3]=8+min(30-(spd*15),50)

if spd<>0 then 
{
if ftype=0 then {snd=global.sn_fs_tile}
if ftype=1 then {snd=global.sn_fs_wood}
if ftype=2 then {snd=global.sn_fs_metal}
if ftype=3 then {snd=global.sn_fs_grass}

sound_volume(snd,global.s_vol)
} 
else 
{
exit
}

sound_play(snd)

^
-Basically alarm 3 is set to a value calculated from your speed value (or in my case "Spd") with a maximum frequency
-Then it checks if you are moving and sets var "Snd" on what type of footstep to play (ftype is derived from whatever you have to be standing on)
-You can then change the volume using a global volume variable.
-Then it plays the sound effect stored in "Snd"

Enjoy!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users