Help with Randomize pics and difficulty settings
Author |
Message |
Shippuo23
|
Posted: Wed Apr 15, 2009 9:15 am Post subject: Help with Randomize pics and difficulty settings |
|
|
What is it you are trying to achieve?
I need to make a game where I have Pictures going down the screen and they must be pressed by a key before they hit the bottom of the screen
What is the problem you are having?
I need to randomize my pictures when they come down the screen and need help with the difficulty settings please help
Describe what you have tried to solve this problem
<Answer Here>
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
setscreen ("graphics")
var key : string
key := ""
process keys
key := ""
if hasch then
key := getchar
Input.Flush
end if
end keys
procedure Monsta
var Monsta : int := Pic.FileNew ("Monsta.bmp")
for y : 200 .. 600
Pic.Draw (Monsta, 250, (maxx - y ), 0)
delay (10)
fork keys
if key = "m"
then
cls
exit
end if
end for
end Monsta
procedure Witch
var Witch : int := Pic.FileNew ("Witch.jpg")
for y : 200 .. 600
Pic.Draw (Witch, 250, (maxx - y ), 0)
delay (10)
fork keys
if key = "w"
then
cls
exit
end if
end for
end Witch
procedure ghost
var ghost : int := Pic.FileNew ("ghost.jpg")
for y : 200 .. 600
Pic.Draw (ghost, 250, (maxx - y ), 0)
delay (10)
fork keys
if key = "g"
then
cls
exit
end if
end for
end ghost
loop
put "Do you want to play this Game?(y or n):" ..
var reply : string (1)
get reply
if reply = "n" then
exit
elsif reply = "y" then
cls
put "Choose your difficulty(E, M, H)"
var replydifficulty : string (1)
get replydifficulty
exit when replydifficulty = "l"
if replydifficulty = "Easy" then
if replydifficulty = "Moderate" then
if replydifficulty = "Hard" then
end if
end if
end if
end if
loop
var menace : int := Rand.Int (1, 3)
if menace = 1 then
ghost
elsif menace = 2 then
Witch
elsif menace = 3 then
Monsta
end if
end loop
end loop
|
Please specify what version of Turing you are using
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dusk Eagle
|
Posted: Wed Apr 15, 2009 3:32 pm Post subject: Re: Help with Randomize pics and difficulty settings |
|
|
Turing: |
procedure Monsta
var Monsta : int := Pic.FileNew ("Monsta.bmp")
for y : 200 .. 600
Pic.Draw (Monsta, 250, (maxx - y ), 0)
delay (10)
fork keys
if key = "m"
then
cls
exit
end if
end for
end Monsta
procedure Witch
var Witch : int := Pic.FileNew ("Witch.jpg")
for y : 200 .. 600
Pic.Draw (Witch, 250, (maxx - y ), 0)
delay (10)
fork keys
if key = "w"
then
cls
exit
end if
end for
end Witch
procedure ghost
var ghost : int := Pic.FileNew ("ghost.jpg")
for y : 200 .. 600
Pic.Draw (ghost, 250, (maxx - y ), 0)
delay (10)
fork keys
if key = "g"
then
cls
exit
end if
end for
end ghost
|
Do you notice anything similar about these three procedures? The point of using procedures and functions is to prevent the need to copy and paste code. I believe it is critical that you read up on functions and procedures here.
As for the difficulty settings, what is it you want them to do exactly? If for example, you want harder difficulty levels to have your pictures scroll down the screen faster, think of a way to pass a certain speed into your one picture procedure, and have the picture fall accordingly. Be sure to use parameters, which you will learn about above. Good luck! |
|
|
|
|
|
|
|