GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

question-Trying to use one button to destroy and spawn a different actor each time it is pressed

WhiteLightningWhiteLightning Posts: 8Member, BASIC
edited May 2015 in Working with GS (Mac)

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

  • allc1865allc1865 Posts: 777Member, PRO

    Let me see if I can make a template.

  • WhiteLightningWhiteLightning Posts: 8Member, BASIC

    thank you

  • allc1865allc1865 Posts: 777Member, PRO

    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!

  • tatiangtatiang Posts: 11,907Member, Sous Chef, PRO, Senior Sous-Chef

    @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

  • WhiteLightningWhiteLightning Posts: 8Member, BASIC

    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

  • WhiteLightningWhiteLightning Posts: 8Member, BASIC

    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

  • tatiangtatiang Posts: 11,907Member, Sous Chef, PRO, Senior Sous-Chef

    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

  • WhiteLightningWhiteLightning Posts: 8Member, BASIC

    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

  • tatiangtatiang Posts: 11,907Member, Sous Chef, PRO, Senior Sous-Chef

    Here's a demo that might clarify things...

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • IceboxIcebox Posts: 1,483Member

    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..

  • WhiteLightningWhiteLightning Posts: 8Member, BASIC

    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

Sign In or Register to comment.