Howdy, Stranger!

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

Question about changing actors

Samer LuaySamer Luay Posts: 6Member

Hey Guys..

I'm still new to game salad and I'm facing a problem which I couldn't yet solve.

I have one hero for my game each is represent by in actor and each has different rules and behaviors, The problem is I want to switch between the different heroes by pressing a button on the screen but I'm not able to do that.

I only found tutorials which changes the Image of the actor which is not helpful since I want to change the whole actor.

Thanks in advance.


  • dapiondapion Posts: 353Member, PRO

    For my understanding....
    you have two actors, booth of them you can steer (left,right, up, down)or whatever.
    So you want to switch the steering between these two actors?
    If one of them is active the other is passive?

  • Samer LuaySamer Luay Posts: 6Member

    Thanks for your quick replay,

    yes something like that, I want to switch the actor so one appears and the other disappears and when it is switched I want the new actor to appear in the same position as the previous actor...

  • dapiondapion Posts: 353Member, PRO

    For switching...
    You make a button with an integer for switching, 0 is hero 1, and 1 is for hero 2.

    If button "up" is pressed, and integer is 0 you steer hero 1
    If button "up" is pressed, and integer is 1 you steer hero 2

  • dapiondapion Posts: 353Member, PRO

    Same position...
    Make two Real it Pos_X and Pos_Y
    When you steer one actor than constrain the position of the actor to the Real attributes and save them to a table.
    If switching your constrain himself position to the saved attributes.

    I hope it works, certainly I'm not on my Mac to test it.

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

    Consider destroying the existing actor and spawning the replacement actor when you want to switch them. That way you can have two actors with separate rules but only one actor on the scene at a time.

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

  • Samer LuaySamer Luay Posts: 6Member

    dapion thanks for your help..

    I tried your method and It's good but the problem is when I swith the actor the second actor does not move anymore because It is constrained to the real attribute.

    and thanks tatiang for your reply

  • dapiondapion Posts: 353Member, PRO

    Make a Rule,
    if the second hero doesn't reached the correct position (from table) the steering is in automatic.
    If position correct, than activate the manual steering by buttons!

  • Samer LuaySamer Luay Posts: 6Member

    Ok I will try It out thank you very much for your help.

  • dapiondapion Posts: 353Member, PRO

    If this doesn't work,
    I can help you tomorrow with a template for this...

Sign In or Register to comment.