Hi everyone !, hope you are doing greet
. Today let's talk about Animation.
Animation ToolsIn order to simplify Animations management the Nero Engine relies on other tools. Texture Packer and ShoeBox.
Texture packerI've already talked about this one. It's a tool that let you pack several images in one Spritesheet.
When you use Texture Packer to pack your animation, you obtain two files. A image file (.png, .jpeg, etc) and a Json file. The Nero Engine relies on this two files to generate animations.
ShoeBoxWhat is ShoeBox ? ShoeBox also allows to pack image files. But the great thing is that it also allows to
Unpack Spritesheets. When you search for animations over the internet, most of the time you will find some animation SpriteSheets. And there come a question : The animation is already packed, how am I going to use it in Texture packer ?. Well, ShoeBox can unpack SpriteSeets, it can also unpack GIF images. Yep, If you have an animation in GiF format, you can unpack it using an online service or with ShoeBox.
ShoeBox is free, you can find it here.Load AnimationWhen you obtain the two files generated by Texture Packer, you simply have to copy and paste them in the "/Resource/Animation" directory. The rest is automatic, the Engine read your files and build the Animations.
In the picture bellow, you can see that each animation is made of one PNG file and one JSON file. Both files must have the same name.
Animation ObjectOn the left of the Engine Interface, There is now an Animation Tab. All loaded animations can be founded there. Animations work like Sprites. If you put the mouse over an Animation_Button you can see a Preview.
If you click on a Animation_Button you add a Animation_Object onto the Canvas.
Animations are like any other Object, you can move them arround, Rotate them, Scale them, Duplication them etc.
Like Sprite, you can change the Color of your Animation, simply select the Animation Object and process like if it was a Sprite Object.
A Layer of Animations appears with a Yellow color, this is temporary I will review all the Colors for Layer's types
Animations and PhysicsAgain the process is the same as for Sprite_Object. Hold
CRTL and Click on a Animation_Button to add a Animation_Meshed_Object onto the Canvas. When a Animation_Meshed_Object is selected you can go to the Mesh Tab and change the properties of its Mesh Object. When you build your Scene by clicking on the "Return key" or the "Play Button" the Animation_Meshed_Object becomes a Animation_Solid_Object.
A Layer of Animation_Meshed_Object appears with a Light Blue color, this is a temporary color;
Animation SequencesAn Animation is made of Sequences. Each animation has at least one sequence. If the Animation concerns a character we usally have something like ("idle", "walk", "run", "jump"). If the Animation concerns a simple background object like flowers or animals you simply have one sequence.
When you add an Animation Object onto the canvas, the Animation has it's default sequence selected. In order to do that, the Engine need to know the name of the default sequence. For a character the default sequence is the "idle" sequence. But for a none character animation is it called "idle" ? I had three choices : "idle", "default", "The name of the animation". I took the last one.
If you have an Animation called "player" and the following seqences ("idle", "walk", "run", "jump"), the Engine will expect you to name your sequences as followed
("player", "walk", "run", "jump").
If you have a Animation called "flower" whith one sequence, the engine will expect that sequence to be called "flower".
The Sequence TabAlongside with the Sprite, Animation and other Tabs, you now have the Sequence Tab. By default this Tab is empty, but when you select an Animation Object, the Sequence Tab shows all the Sequences available for the selected Animation Object.
From this tab you can configure the frame rate of each sequence. the value is in hertz (inverse of second). If you choose of frame rate of "10", it means "1/10 second";
Animation is not Just AnimationYou can see a
nero::AnimationObject like a nero::SpriteObject that have the power to change is internal Sprite whenever it want. Imagine you have a breakable object in your game. That object will have several state ("healthy", "half break", "break"). This is not a animation, but it can be represented whith a Animation Object.
In order to say to a Animation to stop being a animation, you simply have to tell him to never update itself
animation_object->setUpdateable(false);
After that you have the power to controle the animation manually.
animation_object->setFrame(0) // by default the object is healthy
animation_object->setFrame(1) //the object has been half broken, let go to the second frame
animation_object->setFrame(2) //the object has been complety broken let go to the last frame
that's all for Animation, I will make a post later today in order to present other new features.
Here is a video that shows how Animation looks like