Forum rules - please read before posting.

Transform the player

I want the player to transform in animals. I put 3 buttons, each for one animal. It must have a cool down for each, 10s.
I don't know how to change the player into this animals, and how to put a cool down.
I thought about game object variable but I cant make it work.
I tried to switch the players, but the old one don't disappear and its not a object, so I cant make invisible. I cant switch the sprite, because it would be a mess with colliders and animations.
Any idea of how could this work?

Comments

  • edited April 2021

    To change the Player's appearance, you have two methods:

    1) Have each animal be a separate Player character prefab, listed in the Settings Manager, and swap them in/out with the Player: Switch Action. To have the new one replace the other, check Replace old Player's position?. You'll need to make sure that all Players (including the default) are prefabs spawned in at runtime - you can't use local Players in the scene file.
    2) Have a single Player character, but add animations to their Animator for the various animal types. Then use the Character: Animate Action to control which animations are used. If your Player uses the "Sprites Unity" animation engine, this can be a case of changing the name of the expected Idle/Walk etc animation names, using the "Set Standard" method.

    If you can share details/screenshots on how your Player is animated, I can elaborate further.

    For a cooldown, do you mean you wish to prevent the Player from switching again for 10s?

    You can record whether or not the Player can switch with a Global Bool variable. Create a new Bool named e.g. "Player can switch" and make it True by default.

    Then create a new Actionlist asset named Cooldown, and give it three Actions:

    1) Variable: Set - to set the Bool to False
    2) Engine: Wait - to wait for 10s
    3) Variable: Set - to set the Bool to True

    To have this run without interrupting gameplay, set the ActionList's When running field to Run In Background.

    To then run this ActionList at the same time the Player changes appearance, use the ActionList: Run Action to trigger it. But first use the Variable: Check Action to only have the Player change appearance if the Bool is currently True.

  • I going to try both ways. I use pixel art in a 3d game, however I cant share yet the sprites cs mine is not complete and I use for testing, others people sprites. But you already gave me many ways to overcome this problem. I will post in here, in case I got stuck again.

Sign In or Register to comment.

Howdy, Stranger!

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

Welcome to the official forum for Adventure Creator.