Computer Science Canada

need help with adding a sound clip

Author:  Brad71 [ Thu Mar 24, 2005 5:46 pm ]
Post subject:  need help with adding a sound clip

I got bored with the bouncing ball program so me and my friend wanted to alter it slightly. Mr. T's head bounces around instead of a ball and I want it to play a sound clip when he hits the edge. I figured that part out but don't know how to stop the sound from looping. here's the code, any suggestions.

code:

var picID : int
picID := Pic.FileNew ("mr-t-head.bmp")
var x, y, dirx, diry : int
x := maxx div 2
y := maxy div 2
dirx := 1
diry := 1
process pity
    loop
        Music.PlayFile ("pitydafool.wav")
    end loop
end pity
loop
    x += dirx
    y += diry
    if x < 0 or x > maxx - 53 then
        dirx := dirx * -1
        fork pity
    end if
    if y < 0 or y > maxy - 85 then
        diry := diry * -1
        fork pity
    end if
    Pic.Draw (picID, x, y, picCopy)
    View.Update
    delay (10)
    cls
end loop

Author:  Token [ Thu Mar 24, 2005 6:35 pm ]
Post subject: 

just remove the loop from the process

Author:  Brad71 [ Thu Mar 24, 2005 6:43 pm ]
Post subject: 

Thanks

Author:  Token [ Thu Mar 24, 2005 9:25 pm ]
Post subject: 

your welcome, its actually a pretty good idea for a program, you should draw multiple mr-t's and have them bounce into each other.


: