by @collinhover

Characters are Impact++'s way of separating "living" things from all other entities. Our definition of living is pretty loose, but the basic idea is that if an entity needs to either pathfind, jump, climb, use abilities, automatically animate, or regenerate, then you may want that entity to extend the ig.Character abstract.

Movement and Performance

Do you want your characters to move? Of course you do! When we're talking about very basic movement, with no extra features and no pathfinding to another entity/point, you'll need to do two things: set the performance level and use the move methods.

First, a couple words on performance. An entity's performance property controls how it behaves with regard to movement and physics in the update phase of your game. Think of it like a cascade, where the three levels are static, movable, and dynamic. Static entities skip all movement code in the update loop and only update their animations. Movable entities can move in addition to everything static entities do, but they ignore physics forces such as gravity and don't collide with the collision map. Dynamic entities have full collisions and physics forces in addition to everything movable entities do. The default performance for ig.EntityExtended is static, while the default for ig.Character is movable, and the default for ig.Player is dynamic.

So, if we need a character that can move itself, the character's performance property should be ig.EntityExtended.PERFORMANCE.DYNAMIC. Then, to get the character moving, just call its moveLeft, moveRight, moveUp, and moveDown functions. Note that if you want your character to fly, you should set its gravityFactor to 0, otherwise moveUp and moveDown won't do much of anything.


Quite often, basic movement is fine, but there are many instances where it just won't cut it. For that, we can bring in pathfinding. We won't cover it here, because @Pattentrick has written an awesome tutorial on it already, but know two things: first, all characters have pathfinding built in, and second, if you need characters with AI such as attacking and fleeing, then you should take a look at the Creature abstract (which also has a great tutorial of its by @Pattentrick).


Collisions? Sign me up! Collisions work the same as in ImpactJS, just set the collides property of the entity to one of the options other than ig.EntityExtended.COLLIDES.NEVER. Your options are:

  • ig.EntityExtended.COLLIDES.LITE will get pushed around and never push back
  • ig.EntityExtended.COLLIDES.ACTIVE will get pushed around and push back sometimes
  • ig.EntityExtended.COLLIDES.FIXED will push everything else around and never budge

(note it is possible to get fixed entities to collide, but it is disabled by default by ig.CONFIG.COLLISION.ALLOW_FIXED)


If you want your character to jump like mario, make sure you've set its canJump property to true, and then call its jump method to get hopping. Check out the jumpSteps, jumpForce, and jumpControl for ways to change the jump itself.


Climbing is another integral part of platformers, and it works exactly like jumping. Make sure you've set your character's canClimb property to true, and then call its climbUp or climbDown method. Check out the climbingControl for one way to change the speed of climbing.

States and Animation

Characters looks for a set of animations to use as the current animation based on various properties. You can think of this as automatic animation handling. The set itself is controlled by the animsExpected property, and is set to [ "idle", "move", "stairs", "climb", "jump", "fall" ] by default. You can see how it covers all of the basic states the character may encounter, and then you can expand from there. If you don't like automatic animation handling, you can turn it off by setting the animAutomatic property to false.

Now, before you go and add a bunch of extra expected animations, you'll also need to override the animation switching method. The actual animation switching is done in the updateCurrentAnim method. As an example, when the character is moving, this method will set the animation to move, something like this:

if ( character.moving ) {
     character.currentAnim = character.anims[ character.getDirectionalAnimName( "move" ) ];

Note here the directional animation name, found by getDirectionalAnimName. Animations in Impact++ are directional and based on flip and facing. So, for example, if a character has both canFlipX and canFlipY set to true, your character should have "moveX" and "moveY" animations. On the other hand, if an entity cannot flip X and Y, then the character should have animations for up, down, left, and right, i.e. "moveUp", "moveDown", "moveLeft", "moveRight".


Characters have both health and energy stats, and also have options to regenerate them over time. By default, the regen property is set to false, so you'll need to enable it if you want any regeneration to happen. From there, you can set the regenRateHealth to control how much the character regenerates per tick, set the regenDelay to control how much time passes between each tick, and set the regenAsPctHealth if you want the character to regenerate a percentage of their health instead of a fixed value. The energy regeneration options are all the same, except the word "Energy" replaces the word "Health" in the above properties.

Good luck with characters!

Learn More!

Config file