question-Trying to use one button to destroy and spawn a different actor each time it is pressed
WhiteLightning
Member, BASIC Posts: 8
Brand new to GameSalad, but I am trying to make it so that when the screen is touched actor 1 is destroyed and actor 2 is spawned in another position. Then when the screen is touched again actor 2 is destroyed and actor 3 is spawned in another different position. So far the actor are all being destroyed and spawned with one press of the screen. Thank you to anyone who can help me out.
Comments
Let me see if I can make a template.
thank you
I know after the first item was destroyed, you wanted another object to destroy, but um..I simply don't know how to do it.
But maybe @tatiang can help with this one; he's very brilliant.
Hopefully this template will start you off into a wondrous adventure into GameSalad and you can learn from it.
https://www.dropbox.com/s/slca6cujezfq7i1/Archive 3.zip?dl=0
If you have any questions, please do ask!
Welcome!
@allc1865 Thanks for the compliment.
Do the actors have be separate actors? If not, a simple way to accomplish this is to move the actor each time to a new position (change attribute self.Position.X to ____ and change attribute self.Position.Y to ____).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
You were right, they do not need to be separate actors, and I can move them. But I am still confused how to make it per press. It is still going through all the actions with one press. @tatiang
Never mind, I was wrong, I think they do need to be separate actors because each one has its own different animation when coming in contact with an enemy. Sorry for the confusion @tatiang
Here's something to consider: have a game attribute (integer) called game.whichActor set to 1. When the actor is clicked (when Touch is Pressed), change its position and then change attribute game.whichActor to game.whichActor+1. Have rules for each possible value of game.whichActor that then determine the specific animation for that value.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I tried what you said, but I can only seem to get the first action to work. I press actor 1(which is the screen), actor 2 is destroyed and actor 3 appears in a new position which is perfect. But on the next press nothing is happening. I have game.whichActor attribute set to change to game.whichActor+1 when pressed, but when I make a new rule following the same guidelines but game.whichActor+2 it's not working. @tatiang
Here's a demo that might clarify things...
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I suggest you see a video of Gamesalad Guru , about mod on youtube , it might help , it talks about how to trigger different actions with one button , im kinda new as well so I cant help much but I think the video tutorial might help you figure out the way to do it..
Both of you were extremely helpful. I finally solved the first problem. Thanks for all the help, I'm sure ill be needing more soon. @tatiang @Icebox1910