Computer Science Canada need help with a "replay" button and a "next level" button |
Author: | Justinr666 [ Wed Jan 13, 2010 10:14 pm ] | ||
Post subject: | need help with a "replay" button and a "next level" button | ||
What is it you are trying to achieve? im trying to have so that when you crash, instead of the game exiting, you get a message asking to try again, and also, when you complete the level, a way for you to go onto the second level What is the problem you are having? im not that good with turing code, so i cant figure out how to do it, or even how to start Describe what you have tried to solve this problem ive tried one example i found on here for a retry buttons, but had no luck getting it to work with my game Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using turing 4.1.1 |
Author: | DemonWasp [ Wed Jan 13, 2010 10:18 pm ] |
Post subject: | RE:need help with a "replay" button and a "next level" button |
You have it set up so that your gameplay loop exits when you collide with something. You want to do that multiple times, assuming that the user chooses to continue. What does that sound like? A loop. Put another loop around your existing loop. After your existing loop, have something that asks about whether the player wants to try again, and if not, exits the outer loop. Otherwise, just let it loop back up to the start of your "gameplay loop". |
Author: | Justinr666 [ Wed Jan 13, 2010 10:40 pm ] |
Post subject: | Re: need help with a "replay" button and a "next level" button |
im not sure i quite understand what you mean.. i thought i did have it so it exits after each collison.. ill paste the collsion part of my code again.. % collision detection for the box obsticle if x > maxx - 2 then exit elsif x < 2 then exit end if if y > maxy - 2 then exit elsif y < 2 then exit end if ----------------------------- % when you hit the box, the game exits if x > 49 and x < 151 and y > 49 and y < 151 then exit end if |
Author: | TheGuardian001 [ Wed Jan 13, 2010 11:03 pm ] |
Post subject: | Re: need help with a "replay" button and a "next level" button |
The collision part of your code is fine. What DemonWasp meant was that in order to get the entire game to repeat itself (the stuff inside your current loop), you should add a second loop around the other one, in which you will ask the user if they want to play again. By having this second loop with the play again option, when your main game loop exits, there is another loop which keeps the program going and asks if they would like to play again. If they answer no, you exit the second loop. Otherwise, you let the loop keep going, and it brings you back to the start and into your main game loop again. |
Author: | Turing_Gamer [ Thu Jan 14, 2010 8:38 am ] | ||
Post subject: | Re: need help with a "replay" button and a "next level" button | ||
For example
|
Author: | Justinr666 [ Thu Jan 14, 2010 10:49 am ] |
Post subject: | RE:need help with a "replay" button and a "next level" button |
oh, ok, thank you, i understand now |
Author: | Justinr666 [ Fri Jan 15, 2010 2:09 pm ] |
Post subject: | RE:need help with a "replay" button and a "next level" button |
so i have a new problem, i have a picture for my title screen with text over it, but where ever the text is, is a ugly white box behind it, so i was wondering if there was a way to make it so the text displays directly over the picture with no white box behind it? |
Author: | Zren [ Fri Jan 15, 2010 2:55 pm ] |
Post subject: | RE:need help with a "replay" button and a "next level" button |
Use Font.Draw instead of put statements. You can look up how to use it in the Turing Walkthrough or in the documentation (F9) or http://compsci.ca/holtsoft/doc/. |