How to make an actor disappear and re spawn when colliding with another actor?
Mayhem_Madness
Member, PRO Posts: 168
in Help Wanted
Hi everyone, just wanted some help with collisions, how would I make an actor disappear and respawn in a random place when colliding with another actor, like in the game snake. Also how would I make an actor (the snake) die when colliding into the wall. Thank you for any help.
Comments
First question:
When actor collides with XXX
Change position x to random (0,123)
Change position y to random (0,123)
. . . . . . . . . .
Second question:
What does 'die' mean in this context ?
Like in the game snake, when the snake runs into the wall, it's game over, how would you do that?
IF attribute gameover = true
delete actor snake
change attribute snakeLength = 0
spawn actor snake at x =0, y= 0
change attribute gameover = false
have this in another actor, not the snake.
What happens when the game is over ?
It will just say game over, and you will be able to restart.
Rule:
When snake actor collides with wall actor:
Display text: 'Game Over'
Hi Socks, how would I make the game stop when the actor collides with the wall? Thanks for the help.
What do you mean by 'stop' ? Do you mean the snake stops moving ?
All these things, 'die', 'stop', 'game over' are pretty arbitrary, they could mean anything, can you be more specific, are you able to say what actually happens . . . i.e: you go to the score page, the snake explodes, a 'restart' button pops up, you are taken to the main menu page, the scene fades to black . . . etc etc
?
Hi Socks, going back to the first question would i need a table for this? Would it be possible if you could explain it in a bit more detail please?
The GameSalad Cookbook covers all the basics, it'll give you a pretty good overview.
https://help.gamesalad.com/hc/en-us/categories/200134158/