Using Animation Techniques

By LadylexUK

You can create unique looking characters, talking statues, 8 bit style animation and much more if you use the visibility tile combined with a number variable. Using the basics of animation you can show fixed images in sequence to create the illusion of moment.

First you need to understand that Project Spark runs at 30fps. Traditional animation runs at 24fps so you have two options in creating your animation cells – create 10 and change them every 3 frames or create 15 and change them after every 2 frames. Obviously the more frames, the more cells, the more props are being used, If you are creating a full animation sequence you may need to keep the number of props used for each cell as small as possible, and have as few cells as you can.

Here is how it works.
Create your animated sequence. You can use various animation tutorials to understand what each cell should look like. You can use props to make your animated object or for 8 bit pixel art use primitive squares. Glue all the objects together to make one prop that you can turn the visibility on/off.

In a logic cube

  1. WHEN [once] DO [#anim][equals][1] // or you could set this to 0 to hide all the anim cells
  2. WHEN [#anim][equals][1] DO [iwp:anim cell 1][visible][equals][true]
  3. …WHEN [else] DO [iwp:anim cell 1][visible][equals][false]

do this for all anim cells in the sequence.

Then set the timing for your animation to play

You can do it on a regular loop like this.

WHEN [countdown timer][2][in frames][loop] DO [#anim][incremented by][1]

or

at variable speeds

WHEN [countdown timer][2][in frames] DO [#anim][equals][1]
WHEN [countdown timer][5][in frames] DO [#anim][equals][2]

If you need your animation to play in a loop then add something like this

WHEN [#anim][greater than][9] DO [#anim][equals][1]

If you need the animation to play to match movement then you need to establish facing direction of your player. You can use a raycast on an object in front of the player or you can set the direction based on the controller use (d pad or stick). Use a boolean to control what animation plays.

  1. WHEN [raycast hit][iwp:far right] DO [boolvar: right][equals true]
  2. …WHEN [else] DO [boolvar:right][equals][false]
  3. …/…WHEN DO [boolvar:left][equals true]

and vice versa

or

  1. WHEN [left stick][right direction] DO [boolvar: right][equals true]
  2. …WHEN [else] DO [boolvar:right][equals][false]
  3. …/…WHEN DO [boolvar:left][equals true]

then

  1. WHEN [boolvar:left][and] [moving][and][not][boolvar:jumping]
  2. …WHEN [started to] DO [#anim][equals][1]
  3. …WHEN [#anim][equals][1] DO [iwp:anim left cell 1][visible][equals][true]
  4. …WHEN [else] DO [iwp:anim left cell 1][visible][equals][false]
  5. etc….
  6. WHEN [boolvar:right][and][moving][and][not][boolvar:jumping]
  7. …WHEN [started to] DO [#anim][equals][1]
  8. …WHEN [#anim][equals][1] DO [iwp:anim right cell 1][visible][equals][true]
  9. …WHEN [else] DO [iwp:anim right cell 1][visible][equals][false]

You then need to make sure all your animation cells are positioned in the same place. You will not get convincing animation if the cells are not in the same position. I have only attempted this in a side scrolling mode so you only need to worry about one plane of movement (left to right or z vector).

For fixed animation (such as statue mouths) you can use this kode with each cell iwp on a logic cube placed in the position the animation will play.

  1. WHEN DO [position][equals][iwp:logic cube][position]

For animation on a moving object do the same but the logic cube needs a movement brain or is linked to an invisible player with a movement brain with this kode.

  1. WHEN DO [position][z][equals][iwp:player][z][position]

Note: The position vector of a glued object depends on the orientation and position of the last object selected before glued. This may give you some issues with positioning. Your choices are to glue the object which you will use as the anchor point (position) to your cell last before gluing it all together – or an easier option would be to create a stand (invisible cube) for your animation cell to attach to, and use that for your position.

 

Video

Comments are closed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: