GameSalad

How to make one actor switch with another

bsamargiabsamargia Posts: 8Member, PRO

Is there a way to get it so when a certain button is pressed, the actor that you play as switches out with another actor? My game involves a character who is a small acute triangle, and he has the ability to switch between the different kinds of triangles, so a right or obtuse triangle. To do this, I have different actors with different looks and sizes. The player has the ability to freely switch between the different forms. The thing is, I can't seem to get any rule made that allows for such. Is there a way for me to do this, or am I screwed, as this is an essential part of the game that must be in it, as it is required for a project I'm doing.

Thanks in advance.

Comments

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

    Button actor
    When touch is pressed
         Change attribute game.character to 2

    Triangle 1 actor
    When attribute game.character = 2
         Spawn actor [triangle 2 actor]
         Destroy actor

    When attribute game.character = 3
         Spawn actor [triangle 3 actor]
         Destroy actor

    You can then do the same for the button that switches to character 3 and for triangle actors 2 and 3, etc.

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

  • bsamargiabsamargia Posts: 8Member, PRO

    @tatiang said:
    Button actor
    When touch is pressed
         Change attribute game.character to 2

    Triangle 1 actor
    When attribute game.character = 2
         Spawn actor [triangle 2 actor]
         Destroy actor

    When attribute game.character = 3
         Spawn actor [triangle 3 actor]
         Destroy actor

    You can then do the same for the button that switches to character 3 and for triangle actors 2 and 3, etc.

    Thank you, you are a lifesaver.

Sign In or Register to comment.