1. can some one tell how can i make radio buttons for making a choice and after that moving to the next question
Game - program plays a fragment from a well known melody. It will then give the user 4 possible endings - both in written music form as well as by playing the endings. The user must then correctly select the proper ending to win. Must have at least 3 levels with at least 5 songs on each level.
note.... a music file exist and a picture
2. also how do i refer a button to a procedure such as playing music and not finishing the program ...
Turing: | %set screen up and global variables
import GUI
View.Set ("offscreenonly")
var mainWin := Window.Open ("position:160;160, graphics:640;480")
var font1 : int %font of text in program
font1 := Font.New ("CHASE:15:italic")
var font2 : int %font of text in levels
font2 := Font.New ("Times New Roman:14:italic")
var picID : int
var quitButton, win1Button : int := 0
var Button1, Button2, Button3 : int := 0
var pic : int
var Restart : int := 0
var Start1, Start2, Strat3 : array 1 .. 5 of int
var End1, End2, End3 : array 1 .. 5 of int
%variables for player choice
var choice1 : array 1 .. 5 of int
pic := Pic.FileNew ("music icon.jpg")
%Pause Program
procedure pauseProgram
var reply : string (1)
Draw.Text ("Press any key to continue....", 5, 5, font1, green)
locatexy (284, 15)
getch (reply )
cls
end pauseProgram
%Program Titles
procedure title
var font : int
font := Font.New ("Algerian:28:italic")
Draw.Text ("Music Game", 200, 230, font, blue)
/*picID := Pic.New (200, 215, 410, 262)
for x : 0 .. 278 by 5
Pic.Draw (picID, 200, 230 + x, picCopy)
Pic.Draw (picID, 200, 230 - x, picCopy)
delay (60)
end for */
end title
procedure title2
var font : int
font := Font.New ("Algerian:22:italic")
Draw.Text ("Music Game", 200, 340, font, blue)
end title2
procedure title3
var font : int
font := Font.New ("Wide Latin:24:italic")
Draw.Text ("Music Game", 160, 420, font, 52)
end title3
%program introduction
procedure introduction
var font2 : int
font2 := Font.New ("Wide Latin:22:italic")
Draw.Text ("Music Game", 160, 380, font2, 52)
Draw.Text ("Welcom to the...", 130, 420, font2, red)
end introduction
%background animation of fallinf star
process background
drawfillbox (0, 0, maxx, maxy, black) % black background
var picID : int % decleration of variables
var x, y : int
drawfillstar (20, 20, 40, 40, yellow)
picID := Pic.New (20, 20, 40, 40) %set the boundries of what to copy
for i : 1 .. 20 %the number of stars that are drawn
x := Rand.Int (0, maxx) % Random x Random location for copied picture
y := Rand.Int (0, maxy) % Random y
Pic.Draw (picID, x, y, picCopy) %paste the copied picture on the screen
end for
Pic.Free (picID )
drawfillbox (20, 20, 40, 40, black) % erase the original picture from the screen
View.Update
delay (150)
introduction
for z : 0 .. 1360
drawfillstar (20 + (z div 2), 380 - (z div 4), 60 + (z div 2), 340 - (z div 4), yellow) %star movement diagonally
View.Update
delay (3)
drawfillstar (20 + (z div 2), 380 - (z div 4), 60 + (z div 2), 340 - (z div 4), black) %following tail + erasing elemet
drawarc (20 + (z div 2), 380 - (z div 4), 20, 20, 260, 10, 1)
end for
end background
procedure playChoice
% set if sturcture for choice with trace debug
end playChoice
procedure display
if choice1 (1) = GUI.GetEventWidgetID then
Music.PlayFile ("music.mp3")
elsif choice1 (2) = GUI.GetEventWidgetID then
Music.PlayFile ("music.mp3")
elsif choice1 (3) = GUI.GetEventWidgetID then
Music.PlayFile ("music.mp3")
elsif choice1 (4) = GUI.GetEventWidgetID then
Music.PlayFile ("music.mp3")
elsif choice1 (5) = GUI.GetEventWidgetID then
Music.PlayFile ("music.mp3")
end if
end display
procedure level1
GUI.Hide (win1Button )
GUI.Hide (Button1 )
GUI.Hide (Button2 )
GUI.Hide (Button3 )
title3
Draw.Text ("Level 1", 0, 460, font1, 34)
Draw.Text ("Your to find the right ending for each song given.", 80, 380, font1, 34)
Draw.Text (" The edndings are both in sound and text", 120, 360, font1, 34)
Draw.Text ("Press to play music..", 5, 5, font1, green)
Pic.Draw (pic, 70, 5, picCopy)
%Song 1
Draw.Text ("Unknown Music..", 20, 334, font2, black)
Start1 (1) := GUI.CreatePictureButton (170, 330, pic, display )
choice1 (1) := GUI.CreateRadioButton (60, 140, "Start", 0, display )
choice1 (2) := GUI.CreateRadioButton (60, 120, "Ending 1", choice1 (1), display )
choice1 (3) := GUI.CreateRadioButton (60, 100, "Ending 2", choice1 (2), display )
choice1 (4) := GUI.CreateRadioButton (60, 80, "Ending 3", choice1 (3), display )
choice1 (5) := GUI.CreateRadioButton (60, 60, "Ending 4", choice1 (4), display )
end level1
procedure display2
GUI.Hide (win1Button )
GUI.Hide (Button1 )
GUI.Hide (Button2 )
GUI.Hide (Button3 )
title3
Draw.Text ("Level 2", 0, 460, font1, 34)
Draw.Text ("Your to find the right ending for each song given.", 80, 380, font1, 34)
Draw.Text (" The edndings are both in sound and text", 120, 360, font1, 34)
Draw.Text ("Press to play music..", 5, 5, font1, green)
Pic.Draw (pic, 70, 5, picCopy)
end display2
procedure display3
GUI.Hide (win1Button )
GUI.Hide (Button1 )
GUI.Hide (Button2 )
GUI.Hide (Button3 )
title3
Draw.Text ("Level 3", 0, 460, font1, 34)
Draw.Text ("Your to find the right ending for each song given.", 80, 380, font1, 34)
Draw.Text (" The edndings are both in sound and text", 120, 360, font1, 34)
Draw.Text ("Press to play music..", 5, 5, font1, green)
Pic.Draw (pic, 70, 5, picCopy)
end display3
procedure userInput
delay (1400)
GUI.Hide (win1Button )
cls
GUI.SetBackgroundColor (46)
Button1 := GUI.CreateButton (160, 100, 0, "Level 1!", level1 )
Button2 := GUI.CreateButton (260, 100, 0, "Level 2!", display2 )
Button3 := GUI.CreateButton (360, 100, 0, "Level 3!", display3 )
end userInput
%strart Menu
procedure mainMenu
win1Button := GUI.CreateButton (250, 200, 0, "Play Game!!!!", userInput )
quitButton := GUI.CreateButtonFull (585, 0, 0, "Quit", GUI.Quit, 0, KEY_ESC, false)
end mainMenu
%Main program
procedure MainProgram
fork background
delay (3200)
Restart := GUI.CreateButton (500, 0, 0, "Restart", MainProgram )
mainMenu
end MainProgram
MainProgram
%The goodbye screen
procedure goodbye
cls
title2
Draw.Text ("Thank you for Playing....", 170, 200, font1, green)
pauseProgram
Window.Close (mainWin )
end goodbye
%set Windows
loop
exit when GUI.ProcessEvent
end loop
goodbye |
Mod Edit: Remember to use syntax tags! Thanks code: | [syntax="turing"]Code Here[/syntax] |
|