Computer Science Canada Cart Machine (Sound Clips) |
Author: | pkjr92 [ Thu Jul 10, 2008 3:36 pm ] | ||
Post subject: | Cart Machine (Sound Clips) | ||
This is my cart machine (basically it's a sound clip machine). It uses a custom GUI (not my own, but I can't remember whose) as well as the fork and Music.PlayFile commands to play and stop clips. It is all done, except I can't get the View.Update to work correctly. ![]() I've included the source "cart.t", the code shown below, and the zip file that includes the sound clips and gui module as well. If anyone could help with the View.Update problem, it would be greatly appreciated!
|
Author: | Diablo117 [ Fri Jul 11, 2008 1:37 am ] |
Post subject: | Re: Cart Machine (Sound Clips) |
After playing around with ur code for about 10 mins I found a solution for the seizure-tastic screen u had ![]() Thats the bottom part of the code you will want to edit, if it doesnt work, u can slap me cuse im well known for forgetting to put important details ![]() %<------------------------------------ End Procedure List -------------------------------------> View.Set ("graphics,offscreenonly,nobuttonbar") colorback(255) cls loop exit when G.button (50, 1, "QUIT") G.procButton (50, 375, "Good Night Newman", goto1) View.Update G.procButton (50, 350, "Run Forest Run", goto2) View.Update G.procButton (50, 325, "Bond, James Bond", goto3) View.Update G.procButton (50, 300, "This is the best school I've Ever Teached At", goto4) View.Update G.procButton (50, 275, "Spider Pig", goto5) View.Update G.procButton (50, 250, "121 Gigawatts!", goto6) View.Update G.procButton (50, 225, "Failure is not an option", goto7) View.Update G.procButton (50, 200, "Rick-Roll (ERROR- .mp3)", goto8) View.Update G.procButton (50, 175, "Howard Dean Yell", goto9) View.Update G.procButton (50, 150, "Techno Bond (ERROR- .wma)", goto10) View.Update G.procButton (50, 125, "Techno Star Wars", goto11) View.Update G.procButton (125, 1, "<------------STOP ALL MUSIC---------->", goto12) View.Update delay (100) end loop Edit: Having no life @ 2:51 AM I once again scanned your code and noticed that the quit button doesnt exit game but only ends it, insert this into your module with function button function button (x, y : int, text : string) : boolean Mouse.Where (mx, my, mz) var w := Font.Width (text, bFont) + 10 if mx > x and mx < x + w and my > y and my < y + 20 and mz = 1 then Draw.FillBox (x, y, x + w, y + 20, c1) Draw.FillBox (x + 2, y + 1, x + w - 1, y + 20 - 2, c2) Font.Draw (text, x + (w div 2) - (Font.Width (text, bFont) div 2), y + 5, bFont, fc) Window.Hide (Window.GetActive) View.Update delay (200) result true else Draw.FillBox (x, y, x + w, y + 20, c2) %25 Draw.FillBox (x + 1, y + 2, x + w - 2, y + 20 - 1, c1) %29 Font.Draw (text, x + (w div 2) - (Font.Width (text, bFont) div 2), y + 5, bFont, fc) View.Update result false end if end button if you dont understand how that works then visit Delos's Tutorial about windows here : http://compsci.ca/v3/viewtopic.php?t=8901 |
Author: | pkjr92 [ Fri Jul 11, 2008 4:14 am ] |
Post subject: | Re: Cart Machine (Sound Clips) |
Thanks, it runs smoothly now. I've been programming in Turing for about a year, and everything except the GUI module is mine. Oh, and the reason I didn't put the Window.Hide command in is because I was planning to compile a stand-alone anyway, which terminates when the run window is finished. |
Author: | SNIPERDUDE [ Fri Jul 11, 2008 9:38 am ] |
Post subject: | RE:Cart Machine (Sound Clips) |
Well then... Welcome to Turing and CompSci guys! ![]() |
Author: | Diablo117 [ Fri Jul 11, 2008 11:44 am ] |
Post subject: | Re: Cart Machine (Sound Clips) |
ah cool, that explains it, im on my first week. @Sniperdude, thanks ![]() |
Author: | SNIPERDUDE [ Fri Jul 11, 2008 3:00 pm ] |
Post subject: | RE:Cart Machine (Sound Clips) |
No problem! btw, check out the Turing Walkthrough - it's packed with usefull tutorials |
Author: | Zren [ Fri Jul 11, 2008 3:35 pm ] | ||
Post subject: | Re: Cart Machine (Sound Clips) | ||
You don't really need call12 since Music.PlayFileStop is in itself, a procedure. So this would work too:
|