Computer Science Canada "Music.PlayFile" |
Author: | bucky-lady [ Thu Dec 28, 2006 5:37 pm ] |
Post subject: | "Music.PlayFile" |
okay, so i have to make a song guessing game. Where do i put : process doMusic loop Music.PlayFile ("song.mp3") end loop end doMusic and where do I put : fork doMusic to let it play in 'levelOne' and stop when the user inputs the right answer. and if wrong answer, then go back to mainMenu ? here is the coding : % set up screen/window and size import GUI setscreen ("noecho") setscreen ("position:300;300, graphics:400;400") View.Set ("offscreenonly") % Global Declaration var key : string (1) var finished := false var rangex, rangey, button : int var winID1 : int := Window.Open ("position:300;150, graphics:400;400") var quitBtn, playGame, rules, back : int := 0 var answer : boolean := true var choice : string % All procedures proc title locate (1, 16) put "Song Guessing Game" end title proc pauseProgram locate (10, 1) put "" put "Press any key to continue...." .. getch (key) cls end pauseProgram proc introduction title locate (3, 1) put "This program will play a short melody of a song," put "and you have to guess what song it is. " put "This game will test you on your knowledge" put "on music. Good luck! ![]() pauseProgram end introduction Music.PlayFileStop proc levelOne locate (1, 20) put "LEVEL ONE!" locate(3,1) put "Can you name this song ?" locate(5,1) put "A) When will it be me ?" put "B) Forever you and I" put "C) Back at one" locate (9,1) put "Please enter your final answer : ".. get choice put "" put "" delay(100) if answer = true then locate(9,1) put "Good Job!" pauseProgram else locate(9,1) put "Sorry, try again next time!" end if end levelOne procedure startGame cls put "Play Game" GUI.Refresh cls levelOne end startGame proc instructions cls locate (1, 20) put "INSTRUCTIONS" locate (3, 1) put "BLAH BLAH BLAH..INSTRUCTION GOES HERE" playGame := GUI.CreateButtonFull (150, 300, 0, "Play Game >", startGame, 0, '^P', false) quitBtn := GUI.CreateButtonFull (170, 260, 0, "< Quit", GUI.Quit, 0, KEY_ESC, false) end instructions proc mainMenu %play game locate (1, 21) put "MAIN MENU" playGame := GUI.CreateButtonFull (150, 300, 0, "Play Game", startGame, 0, '^P', false) quitBtn := GUI.CreateButtonFull (170, 260, 0, "Quit", GUI.Quit, 0, KEY_ESC, false) rules := GUI.CreateButtonFull (190, 220, 0, "Instructions", instructions, 0, '^I', false) View.Update end mainMenu proc goodBye title locate (1, 5) put "This program was written by : " put "Cassidy Nguyen" put "Thanks for playing!" Window.Close (winID1) end goodBye % Main Program introduction mainMenu loop exit when GUI.ProcessEvent end loop cls goodBye I'd really appreciate it if you could help me! ![]() |
Author: | Tony [ Thu Dec 28, 2006 5:43 pm ] |
Post subject: | |
using a process with nested Music.PlayFile has been depreciated. Use Music.PlayFileReturn() instead. |