

Observe the “Mouth” (another image) and “Bonus” (enabled) children. It should be hidden most of the time (like in the Idle animation). This object will serve to display an additional image when we want. In your “Boss” Prefab, add a new sprite child called “Bonus”. Just make sure to name the clips “Boss_Attack” and “Boss_Hit”.

It’s a good opportunity to test what you have learned before. Now, it’s time for you to experiment! Here’s what you should have in the end:įor these animations, we will give an example of what you may achieve, but we recommend you to have fun and make your own.
ROTATION AS A VECTOR 2D UNITY UPDATE
Update the collider size to make it fit the animation.Change the sprite (of a “Sprite Renderer”).You can update the position ( do not do that on the container).We just made an animation using the rotation, but you can update every property of the object and its children. The animation doesn’t look the same: it’s way faster with a pause between loops. For example, if we mess the whole thing a bit:

It will update the keyframes and their associated values. We can play with the curve by dragging the points. Our current idle animation is looking like a regular sinusoidal currently: This is a special tab that you can toggle in the bottom left corner of the “Animation” view: You have two solutions: You can add other keyframes in between, or play with the Curves. However, you may want a non-linear interpolation (starting fast and ending slowly for example). Playing with curvesīetween each keyframe, Unity uses a linear interpolation to deduce the intermediate values. Here we are working on the parent because we want everything to rotate together, but maybe we should have add an empty parent object on top of everything that is never animated. Most of the time, you want to change the children properties and not the container. We’ve got:Ĭhanging a property of the “Boss” object: if you change a property of the parent object (the “Boss” object here), be extremely vigilant, especially with the “Position”.įor instance, if you change the “Position” of the “Boss” object in an animation, its real position in the scene is going to be changed for the one in the animation each time it is played. For each one, add a “Sprite Renderer” and select the appropriate image (body, eye or mouth).Ĭhange their position to get something like this:įor example, the left eye game object has been positioned with the mouse in the editor. That is why we don’t have a “Sprite Renderer” here.Ĭreate 4 empty game objects as children of the “Boss” object. This object does not display anything.Add a “Box collider 2D” with a size of (6, 6).Add a “Rigidbody 2D” with no gravity/fixed angles.To have the proper configuration, create an empty game object. Use the automatic slicing feature (a size of 32 should be fine): Set its “Sprite Mode” to “Multiple” in the “Inspector”.The sprite is made of multiple images: a body, the eyes and some additional stuffs. There are some differences, especially about components access, but the features are the same. As the player moves in and out of these different triggers, the vector2s for each of these triggers would be added and removed from an overall value as sensed by the player.Warning: this part of the tutorial has not been updated to Unity 5. Think of moving through a scene, with different regions of wind defined by direction, and magnitude. I'm pretty sure the Trigonometry and Vector2 action sets would contain everything I need, I just couldn't seem to apply the maths.Įdit, thought I'd expand on the blending aspect. I don't need to change the rotation and magnitude once set, instead I would blend between vector2s as the player moves around the scene (would be interested to discuss the best way of doing this too). I can get the rotation, and the magnitude would be a float variable, but I can't work out the translation of these to a vector2.

I'd like to store a Vector2 derived from an angle along the z axis, along with a magnitude. Thanks Jean for the excellent new action set! I have all the basic interactions correct, however I can't quite wrap my head around the final stage. I'm currently updating a project from 3d physics to the new Unity 2D system.
