Animation File Guide
iAppsBeats uses BANI files to create key-frame animations for the game, and in order to make animations out of them, the file contents are in JSON format so that the game can easily read the data. The bani file is then uploaded into the File repository for the game under animations folder.
iAppsBeats uses a custom in-house developed animation editor, which is found on iappsbeats.com/animations/.
You can also create particles using bani files, see Particle Engine for more information.
Properties (Introduction)
a BANI file consist of a few basic properties. You have the filetype
& aniversion
, so that the game knows that this is an animation file and which engine animation version it should use to parse the file.
"filetype": "bbuilderani",
"aniversion": 1
There is the options
object which tells the game some basic properties such as if the animation should be looping, be continuous, and where the center of the animations are, and a few other things.
"options": {
"looping": 0,
"continuous": 1,
"center": [24, 24]
}
You also have defaults
where you can place template properties for your sprites that can be overwritten by the game, i.e. the player outfit (hat, head, body, etc.) or which arrow to use for projectile-
"defaults": {
"ARROW": "bbuilder_arrow1.png"
}
You can also use ARG1..9 to reference this./player.aniarg1..9 set by script. Parameters provided to the this./player.ani attribute after a comma can be referenced by PARAM1, PARAM2 etc.
After that- You have the sprites
object and frames
object, where you define the sprite id, bounds and image (gfx
), and fames you place how these sprites are shown using it's ID and positions.
- Sprites:
"sprites": {
"0": {"gfx":"bbuilder_arrowshadow.png", "bounds":[0,0,64,16]},
"1": {"gfx":"ARROW", "bounds":[0,0,80,16]}
}
- Frames
"frames": [
{
"directions": [
[[0,-24,0], [1,-24,-8]]
],
"sound": ["arrow_fly1","arrow_fly2"]
}
]
Supported Properties
Root level properties
- filetype: string - must be
"bbuilderani"
- aniversion: int - must be
1
(unless an newer breaking change animation version is created for the game-engine) - copyright: string - optional property for showing who made the animation, typically set to
iAppsBeats LTD
- options: object - an collection of options for the animation (see Options properties below)
- defaults: object - used to define the default values for the "variables" used within the animation (e.g. head, body, etc.)
- emitters: object - optional, used to define emitter objects for the animation (see emitters properties below)
- sprites: objects - the definition of the sprites, image, size, rotation and bounds, where the object name(or id) is the sprite number to be used in a frame-object.
- frames: array of (frame-)objects - the definitions of keyframes that makes up the animation, as seen in-game.
Options properties
- looping: boolean, set to
true
(or1
) for animation loops - continuous: boolean, set to
true
(or1
) to make the animation continue playing even when animation is assigned again, set to0
to make it restart each time - center:
[16, 16]
- deprecated, animation is displayed at center minus [16,16] if specified - atend: string, example:
"player_idle"
- switch to this animation when animation is finished - blockingbounds: [x,y,width,height], example:
[0,0,32,32]
- rectangle of the NPC, only width and height are used, only used on client side - nameoffsety: number, exaple:
45
- draws the name at a pixel offset - chatoffsety: number, example:
32
- draws chat at pixel offset - particleslayer: string, set to
"drawunder"
to draw particles below the player - scaleshadow: boolean, set to
true
(or1
) to scale sprite 0 depending of the z value - showonwater: boolean, set to
true
(or1
) to show pets while player swims - animateidle: boolean, set to
true
(or1
) to continue pet animation while player stands still - zoom: number, example:
2
- for zooming the whole object - color: [red,green,blue], example:
[1,1,1]
- setting a color for the whole object - ischair: boolean, set to
true
to make the NPC behave like a chair - isbed: boolean, set to
true
to make the NPC behave like a bed - particlescontinueafterdeath: boolean, set to
true
to show particles even after the object already disappeared - canrotate: boolean, set to
true
for rotatable furniture - hitbox: object, can be used to replace the default hitbox of the object, supported are circle and rectangle:
{"shape": "circle", "center": {"x":16, "y":16}, "radius": 16}
,{"shape": "rectangle", "bounds": [0, -16, 32, 48]}
(all numbers are pixel amounts, bounds is [x,y,width,height]) - attackbounce: boolean, set to
true
(or1
) on gun servers to enable bounce effects when attacking - showgrab: boolean, set to
true
(or1
) to show the grab button if the player stands in front of the NPC (if grab button is enabled) - replaceplayerani: boolean, set to
true
to have tiletypeanis should replace the player animation instead of drawn above/below - tiletypes: object, can be used to change the blocking behaviour of the NPC more precisely, example:
{"width":32,"height":32,"tilewidth":16,"data":[2,0,2,2]}
Default properties
Attributes defined in the defaults section are preloaded and reference attributes of the NPC or player when used by sprites.
Emitters properties
You can define an array of "emitters", see Emitter for parameters.
Sprites properties
- id: object - the id number of the sprite as key, and value is an object with the following properties:
- gfx: string, a graphic file from the /Files/images/ path
- bounds: list - [startx, starty, width, height], defines the boundaries of the sprite to show in the animation
- scale: list - [scalex, scaley], scales the sprite, [1,1] is the default
- rotation: list - [degreeangle, centerx, centery], defines by which angle (0..359) around which pixel coordinates the sprite should be rotated
- ambient: list - [from, to], defines an ambient range between 0 and 1 in which the sprite should be visible, the ambient value is the average of the current red, green and blue ambient colors
Frame(s) properties
- directions: array - a list of every (4) directions with the frames being played at what x/y position for which sprite-id, this can be only one direction if it's an single-direction animation e.g. a projectile or an NPC animation (such as Trees, etc).
- duration: number - time in milliseconds that the frame should be played
- sound - sound filename without extension or array of sounds, will play randomly chosen between the entires of sounds for this frame
- soundchance: number 0..99 - will play the sound by probability
- emit: emitter to emit, or array of emitters, if array of 4 arrays then provide separate emitter lists for each direction
- screenshake: object - {"strength":20, "duration":500, "distance":10} -> strength is pixels, duration is milliseconds, distance in tiles (one tile 32 pixel). Examples of use in the default animations explode.bani and hammer_atk.bani