Need help with loops!
Author |
Message |
bitbyamonkey
|
Posted: Tue Jun 14, 2011 9:22 am Post subject: Need help with loops! |
|
|
i am trying to make an eyespy game in turing. i have to make it so when you miss the correct itme it loops you baCK to the beginning. How can i do this?
var backG1 : int := Pic.FileNew ("titlee.bmp")
var backG2 : int := Pic.FileNew ("FirstFind.bmp")
var backG3 : int := Pic.FileNew ("SecondFind.bmp")
var xMouse, yMouse, buttonStatus, x2Mouse, y2Mouse, button2Status, x3Mouse, y3Mouse, button3Status : int
%Main Method
loop
cls
Pic.Draw (backG1, 0, 0, picMerge)
Music.PlayFileReturn ("Europe - The Final Countdown.mp3")
loop
mousewhere (xMouse, yMouse, buttonStatus)
exit when xMouse >= 0 and xMouse <= 9001 and yMouse >= 0 and yMouse <= 9001 and buttonStatus = 1
end loop
cls
Pic.Draw (backG2, 0, 0, picMerge)
loop
mousewhere (x2Mouse, y2Mouse, button2Status)
exit when x2Mouse > 130 and x2Mouse < 175 and y2Mouse > 70 and y2Mouse < 100 and button2Status = 1
end loop
cls
Pic.Draw (backG3, 0, 0, picMerge)
loop
mousewhere (x3Mouse, y3Mouse, button3Status)
exit when x3Mouse > 300 and x3Mouse < 901 and y3Mouse > 300 and y3Mouse <= 9001 and button3Status = 1
end loop
end loop
I need to loop it someway back to the beginning
i have tried if and elsifs to the best of my ability |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
2F_Zelda
|
Posted: Tue Jun 14, 2011 10:29 am Post subject: Re: Need help with loops! |
|
|
You could make it so that when the user misses, a flag variable is triggered. You can then use said flag variable to decide whether or not to continue the game or loop it back to the beginning. |
|
|
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: Tue Jun 14, 2011 11:49 am Post subject: RE:Need help with loops! |
|
|
What's the difference between the three scenes?
A BG picture, and a box representing the sweet spot to continue on (a pair of coordinates to form a rectangle).
Try making a function that will proceduralize each scene. Remember that parameters are used for things that are variable between similar code. |
|
|
|
|
![](images/spacer.gif) |
klutzedufus
|
Posted: Wed Jun 29, 2011 9:23 pm Post subject: RE:Need help with loops! |
|
|
You could make a loop within a loop, and exit when they don't click the right item. When it exits the first loop, it will still be in the other loop and will go back to the beginning of the first. |
|
|
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: Mon Jul 04, 2011 10:34 am Post subject: RE:Need help with loops! |
|
|
theres an actual tutorial for that. look up fake goto line. |
|
|
|
|
![](images/spacer.gif) |
|
|