Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 need help with adding a sound clip
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Brad71




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Token




PostPosted: Thu Mar 24, 2005 6:35 pm   Post subject: (No subject)

just remove the loop from the process
Brad71




PostPosted: Thu Mar 24, 2005 6:43 pm   Post subject: (No subject)

Thanks
Token




PostPosted: Thu Mar 24, 2005 9:25 pm   Post subject: (No 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: