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

Username:   Password: 
 RegisterRegister   
 Bubbles???
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Hackster




PostPosted: Sun Apr 11, 2004 2:29 pm   Post subject: Bubbles???

hey, i was thinking of making a fish screensaver, like where the fish swim around ... and i can't figure out how t make bubbles that go up the screen, and with sound too ... plz, ill post if i get some progress thanks!
Sponsor
Sponsor
Sponsor
sponsor
apomb




PostPosted: Sun Apr 11, 2004 2:46 pm   Post subject: (No subject)

Well, Well Well i have the perfect thing...
code:

var x, y : int
procedure bubble
    loop
        sound (100, 100)
        sound (200, 50)
        sound (300, 50)
        delay (Rand.Int (500, 2000))
    end loop
end bubble
colorback (blue)
cls
process bubbles
    loop
        x := Rand.Int (1, maxx)
        color (white)
        locatexy (x, 1)
        put "O"
        delay (70)
        color (3)
        locatexy (x, 1)
        put "o"
        delay (70)
        color (3)
        locatexy (x, 1)
        put "."
        delay (70)
    end loop
end bubbles
fork bubbles
bubble
gamer




PostPosted: Sun Apr 11, 2004 3:03 pm   Post subject: (No subject)

hackster, how did u make ur fish program??
plz tell me
greenapplesodaex




PostPosted: Sun Apr 11, 2004 3:59 pm   Post subject: reply

i dont get it
there's no saying "y+1" or anything like that, then why does the bubbles go up every loop?
and i know how "fork" works, but i never knew it can generate infinet bubbles this way, can anyone explane???















P.S. pleaaaaaaaaaaaaaaaaaaaase???
Tony




PostPosted: Sun Apr 11, 2004 4:39 pm   Post subject: (No subject)

well after a bit of experimenting, it appears that using locatexy will push the output above up, so there's no need for the y variable Confused
code:

for i:1..10
locatexy(1,1)
put i
end for


the reason for a lot of bubbles is that each time though the loop, a new X value is generated, resulting in a new bubble
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
apomb




PostPosted: Mon Apr 12, 2004 2:16 pm   Post subject: (No subject)

Yup! this is exactly how i did it, yet i cannot figure out how to make them go DOWN the screen... but ya the next loop just pushes up the last line of text, moving it up the screen. and to explain the "fork" thing, that is the only way i could get the sound to work at the same time as the text moving, otherwise, the bubbles would stop every time there was a sound generated.
gamer




PostPosted: Mon Apr 12, 2004 2:45 pm   Post subject: (No subject)

but the bad thing is that the sound dun even match with each bubble appearing, any way to fix this?

btw if the background is moving water or with moving fishes that'll be MUCH better
apomb




PostPosted: Mon Apr 12, 2004 2:53 pm   Post subject: (No subject)

well, i just wanted the felling of the aquarium, i didn't want to go too in depth with fish and stuff, hackster can do that for himself!
Sponsor
Sponsor
Sponsor
sponsor
gamer




PostPosted: Wed Apr 14, 2004 5:11 pm   Post subject: (No subject)

ok then 4get the fish, but is it possible to hav the sound played only when a bubble appears?? cuz rite then the sound n bubbles dont match at all
apomb




PostPosted: Thu Apr 15, 2004 12:35 pm   Post subject: (No subject)

there might be, but right now, they are separate processes, like i said before, if they were to run in one process, the bubble would stop while the sound was playing. but i challenge you to try it! Smile
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  [ 10 Posts ]
Jump to:   


Style:  
Search: