how to change a actor to another

defovedefove Member Posts: 27
edited November -1 in Working with GS (Mac)
there is a button and a actor1 in the scene.
and there is a actor2 in the game actor panel.
i hope when i press the button change the actor1 to the actor2,how to do that?

Comments

  • AjBlueAjBlue Member Posts: 215
    you can just make an animate behavior to change the actor, if actor1 and actor2's code is the same there is no point to have two, just have animate change the image
  • defovedefove Member Posts: 27
    you are right,but the actor1 and actor2 both are annimation already
    i hope to use the press button to change the two animation in the scene.
  • RattleheadRattlehead Member Posts: 485
    If they both contain animations and behaviours that you want to preserve when you make the change, the only option I can think of is to maybe destroy 'Actor1' and spawn 'Actor2' at the same X and Y co-ordinates.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    what you would have to do is make 2 real attributes, call them actor1x and actor1y. Then make a interger attribute and call it switch. In the first actor you want to start out onscreen constrain attribute actor1x to self position x and actor1y to self position y. Then have a rule in it when attribute switch=1 change attribute self position x to( any number offscreen) and change self position y to (any number offscreen. Then for the second actor that you want the first one to switch to drag it intoo your scene but position it offscreen. Then in that second actor have a rule when attribute switch=1 change attribute self position x to actor1 x and change attribute self position y to actor1y.

    Then finally have a rule in the button you want to press to swticvh them when actor recieves event touch is pressed change attribute switch to 1.

    Hope that helps
  • defovedefove Member Posts: 27
    thanks
Sign In or Register to comment.