- Home /
Unity 2D - Yoshi styled "PowerUp"-Creature
Hey there,
i need a little help - again. I'm trying to create a Power Up which allows my player to fly around (it's an infinite runner), an basically it shall be a creature, on which the character hops on and then rides it. I got the mechanics for the "flying" (basically it works like a jetpack...), but what I'm struggling with is how to change the sprite and colliders of my character. Of course, while riding the creature, my character shall not touch the ground by himself,but the creature shall do. So I thought of 2 methods:
1: animate that whole thing. Create a new animation sprite which includes the player and the creature, change the colliders and everything during that animation. As soon as picking up the creature, the actual PowerUp-Object is destroyed and the animation plays. I guess this is very intensive in terms of performance...
2: create the creature as a child-gameobject of the character and set it active by picking up the powerup and deactivate it afterwards until the power up is picked up again... but in this method there is still the question about the collisions - how could I tell the character, that he doesn't "fall through" the creature but keeps sitting at it. If the creature touches the ground, it may run (what else?!...)
I also thought about picking up the whole creature and attach it as child as soon as the player hits it, but that caused some weird issues which were related to the fact that the power up might be spawned several times during the run (at least I guess the issue was in relation to that).
Has anyone done something comparable or an idea how to best realize that? Would be awesome! Thanks in advance!
Answer by tiagojcosta29 · Apr 01, 2015 at 02:07 PM
You can attach the creature as a child with the coliders, and then you can activate/deactivate the whole thing by script. So when you pick the power up, you just need to turn it on and the new coliders will be there.
Your answer
Follow this Question
Related Questions
2D platformer - character clips into the ground 1 Answer
Controller Button Issues 0 Answers
In my 2D platformer game, how would I create a height marker?, 1 Answer
How do i make my player sprite change, when entering a powerup? 1 Answer
Player has jittery and slow movement when child of an animated object. 0 Answers