The recipe...
There are multiple ways to make character animations and the two principal ones I used on UpIt are Skeletal Animation and Sprite Animation. Skeletal Animation: It consists in creating a skeleton for the character and manipulating the bones to produce movements. Works well for stickman's like characters. - You create an asset for each body part. - You can create a hierarchy (i.e. hand inside arm container). - You define different positions with the coordinates of each part for each position (That's the long part) - You animate by moving each part from coordinates of the current position to the next one. (i.e. idle -> run -> idle -> ...) Sample Games: https://upit.com/up/NeoRetroBasket; https://upit.com/up/AthleSticks Sprite Animation : Here you use a sequence of pre-drawn images, or sprites, in rapid succession to create the illusion of movement. Problem : Current image generators are not good enough to create coherent sprite sheets. You can generally get 2-3 frames, but if you want more, you need to draw them yourself or import them. A good source of free sprite sheets is https://itch.io. For this demo I used Hormelz's 8-Directional Knight Character (https://hormelz.itch.io/8-directional-knight). Here's how: - I downloaded the animation Bundle - I selected the animations I wanted to use : Idle, run and attack - I used FreeConvert (https://www.freeconvert.com/gif-to-png) to convert each Gif image for each 8 directions into a group of Png files : 1 file per direction for idle, 8 for run and 15 files per direction for attack => ~190 files - I uploaded the Pngs 8 by 8 by group of anim-direction - I copy/pasted a `LK.init.image(...)` line to prepare the 8 assets in the game with a generic name like 'knight-run-dir1-001', 'knight-run-dir1-002', ... - I affected each image to each asset one by one (That's the long part) That's it for asset preparation. It looks complex when written, but when you are doing it, it's simple and mechanical: just a bit of patience and organization. When it's done, you have all you need to make your character perform all actions you want (at least the ones on the sprites...) For the in-game usage, I choose to preload all assets in arrays per action. And asked for an equivalent array for the shadow (i.e.: `knightAttackAssets` & `shadowAttackAssets` (shadows use the same frames with small offset, black tint and low alpha) Then you let Ava handle the animation details using asset visibility. That's it. Now your turn to animate!
41
I didn’t see you talk much about using the bounding box. Is that for keeping animations aligned properly?
Good Point.
In fact, I added this bounding box just because frames (assets) are 256x256px but the character itself is less than 100x100.
So it is done to avoid intersections from occurring far from the visible character.
By the way, it should be better with an ellipse shape in that case.
The alignment was already perfect in the sprites I used so that's a lot of problems avoided.
We are having internal conversations about spritesheets animations. This adds a lot of value to our conversations. THANK YOU
You're welcome 😉
Here are my comments on using the tool for this sprites demo:
- It would be cool to have folders to organize Assets and reduce Assets' page loading time
- It would be cool to keep the Asset File name after the assets is added, like during the upload step
- It would be cool to handle a full Sprite Sheets directly without the need of manually spliting it (but that one is quite a heavy feature😅)
For the rest, I find that the engine handles the frames well enough👍🏽
I have been experimenting with the easiest way of splitting, we may not even need to do it manually :) Will keep you updated ♥️ Also tested several Image AI generators for spritesheets, seems also we are almost there already.