
-----------------------------------
God
Sun May 11, 2003 3:20 pm

Sound effects in mario
-----------------------------------
Alright, so im makin a Mario clone, it works fine for running and jumping and animations and so on. Problem is, i put in some coins that spin through animation, then i put in sound effects (ie. jumping, fireballs,background music...) but whenever mario jumps into a coin the coin sound plays over and over itself until he is out of the coin.
its a process and its not inside a loop or anything and i cant figure out how to fix it

 :?:  :?:  :?: 
here is the if statement

if mariox + mariowidth > coinx and mariox < coinx + coinradius and marioy + marioheight > coiny and marioy < coiny + coinradius then
        fork PlaySound (CoinSound)
    end if

i understand WHY it doesnt work, but i need to know HOW to fix it

-----------------------------------
Homer_simpson
Sun May 11, 2003 3:51 pm


-----------------------------------
you know when those sorta things happen to me i declare a boolean, check this to see what i mean

var play_coin:boolean:=false

loop
%blah blah
%blah blah
%blah blah

if supposed to play the sound effect then 
play_coin:=true
end if

%blah blah
%blah blah
%blah blah
if play_coin then
play("coin sound effect.wav")
play_coin:=false
end if
%blah blah
%blah blah
%blah blah
end loop

This usually solves my problem i dunno if it'll work for u or not... =/

-----------------------------------
hello
Sun May 11, 2003 3:56 pm

hello
-----------------------------------
when u play the music u should have a checking statement that if u are in the coin u play the music
and then another if that when u are not in the coin u play another music

-----------------------------------
Homer_simpson
Sun May 11, 2003 4:08 pm


-----------------------------------
isn't that just what i said??!!  :evil: :x  :evil: :x

-----------------------------------
God
Sun May 11, 2003 4:33 pm


-----------------------------------
I got the sound working and the coin dissappears and so on now.... but i tried it with multiple coins and when i hit one they all dissappear.....
hmm....


var hit : boolean := false
procedure coin (position, height : int)
    if c > 8 then
        c := 1
    end if
    coinx := maxx - coinpos + position - mariox
    coiny := height
    coinradius := Pic.Width (Coin (c))
    if mariox + mariowidth > coinx and mariox < coinx + coinradius and marioy + marioheight > coiny and marioy < coiny + coinradius then
        if hit = false then
            fork PlaySound (CoinSound)
            Pic.Draw (Coin (0), coinx, coiny, picMerge)
        end if
        hit := true
    elsif hit = false then
        if backx 