is there any reset call

I’m doing a game in main.lua only. No storyboard.

only one file.

every time I want to see the changes or try it again

I press – command+R

and that relaunch the app fresh from start

something like the

scene:addEventListener( "createScene", scene )

on storyboard, a call to star all over again.

is there any command to substitute for – command+R?

so when I’m in main I can just press a button to start all over again

without having to press command+R

thanks for your help

You want to change one command for other? What logic behind? - makes no sense for me

@piotrz55 - I think he means he wants to have a button inside the app that essentially ‘restarts’ the app - like when you refresh/restart the simulator.

I’m sure there are a few different ways to do what you want, but the way I would do it is to have a button that purges, exits and then reloads the scene/file.

edit: take a look at this post: link

What happens, it’s that I have a pinball machine game.

a ball is falling down, and bouncing in many objects.

if the ball “lands” in the bottom in a certain place

they get points – I need that to detect – ball and rect


the problem is that my objects, are moving always, in a random position

and transition to another place.

so sometimes, the falling ball, get stuck in the middle of the game

it STOPS!

so I have to re-launch the game to start all over – command+R

that’s why I need it a relaunch command.


unless there is a function that can detectect, if the ball – just stop moving

now make more sense?

Ahh, I see.
Well I would the say the first thing you should do is fix the problem of the ball getting stuck.
You could do it by changing the attributes to your various numbers *bumpers etc… or you could add a ‘Tilt’ option for when the ball gets stuck - my guess is that it would just apply a bit of force to the ball in whatever direction you tell it to “tilt the machine”.

As far as the logic for restarting once a ball has fallen past the ‘bumpers’, you could do it multiple ways.
You could just remove the ball and create&position a new one (you could limit this to a certain number of balls/lives) or simply move the original ball back to the start if it goes beyond your rect/boundary.
(That would be my approach anyways)

Good-luck! :smiley:

-Saer

thanks!

You want to change one command for other? What logic behind? - makes no sense for me

@piotrz55 - I think he means he wants to have a button inside the app that essentially ‘restarts’ the app - like when you refresh/restart the simulator.

I’m sure there are a few different ways to do what you want, but the way I would do it is to have a button that purges, exits and then reloads the scene/file.

edit: take a look at this post: link

What happens, it’s that I have a pinball machine game.

a ball is falling down, and bouncing in many objects.

if the ball “lands” in the bottom in a certain place

they get points – I need that to detect – ball and rect


the problem is that my objects, are moving always, in a random position

and transition to another place.

so sometimes, the falling ball, get stuck in the middle of the game

it STOPS!

so I have to re-launch the game to start all over – command+R

that’s why I need it a relaunch command.


unless there is a function that can detectect, if the ball – just stop moving

now make more sense?

Ahh, I see.
Well I would the say the first thing you should do is fix the problem of the ball getting stuck.
You could do it by changing the attributes to your various numbers *bumpers etc… or you could add a ‘Tilt’ option for when the ball gets stuck - my guess is that it would just apply a bit of force to the ball in whatever direction you tell it to “tilt the machine”.

As far as the logic for restarting once a ball has fallen past the ‘bumpers’, you could do it multiple ways.
You could just remove the ball and create&position a new one (you could limit this to a certain number of balls/lives) or simply move the original ball back to the start if it goes beyond your rect/boundary.
(That would be my approach anyways)

Good-luck! :smiley:

-Saer

thanks!