How to make a start over button function the same way as a start button?

questions
codehelp
answered

#1

How do I link my start over the button to my “tap to start” button?
Here is my tap to start code:
1.
2.
3.
4.

Here is my start over code:
1.
2.
3.
4.


#2

@boyboy To start off, it would be really helpful if you include the code you meant to add, because the lists are blank right now. Also, please clarify your question. What play and restart buttons? The ones already there, or custom ones you made? Please include some more information so people will be able to help you efficiently.


#3

Why don’t you just put something saying “Tap the restart button”?

Also, there’s a tag list for this:
@CodeHelp


#4

I apologize. I thought I wrote it.
Main character:
when phone is not pressed
bring to the front
set text to (PLAY) color black
set size percent 100
When phone is tapped:
set invisbility to 100

So Start OVER BUTTON: **** I NEED HELP WITH THIS
when self is pressed
bring to front
set text to (PLAY) color black
set size percent 100

Game Over: (I got this)
When game starts
set invisibility percent 100
set position x__ & y__
set size percent 150

When main character bumps into obstacles
wait millisecond ___
set invisbility to 0
set color ___
repeat forever
bring to front


#5

I dont get a restart button


#6

@boyboy So, from what I understood, you can try utilizing a variable. I’m still not sure what you are going for, but you can set it up like:

“when variable(start) = 1”
and then the code you would normally put for the rule “when game starts” for each object

(So you can just change all the “when game starts” rules to “when start=1”)

“when game starts”
set variable(start) = 1
wait 100
set variable(start) = 0

and

“When character dies (or something that signals a restart)”
set variable(start) = 1
wait 100
set variable(start) = 0

This is the way I have done it in many games, so let me know if this is what you were looking for or if I must elaborate.


#7

Thanks. I am trying to make a restart button once the game is over.
So the "variable(start) is iphone or objects?
Sorry if you dont mind elaborating.
The way my game is set up is that when the main character bumps into obstacle then the game is automatically over.


#8

@boyboy Yes, make that a an “iPhone” variable, since you want all the objects to react to it like it’s the project being played fro the first time. When the character dies, set the “start” variable to 1 for a short time just to trigger the events that would normally come from the projects original play button for each object. The restart button you want can be your “start button” you use once the project loads, and just change the text on it once you play it the first time to “restart” so you don’t need to change any other rules. Or just trash the button after it starts, and have it automatic. Depends on the game.


#9

@tankt2016 Because you loose your high score and other in game progress, so coding one would be a little harder but much more rewarding in the final product.


#10

@boyboy Just curios, did it work or did you not obtain a chance to try yet?


#11

yeh so imma work on it today. Sorry couldn’t login for a few days


#12


#13

Tell me what I m doing wrong because I am soooo confuse. I dont wanna give up