Question about changing actors

Samer LuaySamer Luay Member Posts: 6

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.

Comments

  • dapiondapion Member, PRO Posts: 353

    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 Member Posts: 6

    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 Member, PRO Posts: 353

    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 Member, PRO Posts: 353

    Same position...
    Make two Real attributes...call 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 hero...you constrain himself position to the saved attributes.

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

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

    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 Member Posts: 6

    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 Member, PRO Posts: 353

    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 Member Posts: 6

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

  • dapiondapion Member, PRO Posts: 353

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

Sign In or Register to comment.