Greetings from Kiwi.JS v1.3.0 “Moriarty”

Hello readers. Today we are happy to announce the release of Kiwi.JS version 1.3.0, “Moriarty”. This release is named in honour of Brian Moriarty, designer of Loom, a fantastic fantasy game made by LucasArts in the 90s that inspired many of us here at the studio to embark on our game development journeys. “Moriarty” also sounds like you are talking to a cunning and dastardly villain, which we think makes it sound awesome.

This latest version of Kiwi brings new features to multiple areas of the engine. Instead of focusing on a particular area to upgrade we decided to add in a lot of niceties that we have always wanted, such as window focus/blur events, window visible status, passing parameters to State preload methods, plus much more.

You can download Kiwi.JS v1.3.0 on github now.

New Features

  • Window focus/blur events added to the Stage allowing users to easily pause/resume their game. (#23)
  • The Animation Component will now look for sequences on their given texture atlas if told to play a sequence that can not be found. (#83)
  • TileMapLayers have been seperated into Orthogonal and Isometric classes to keep code more maintainable as well as more succinct. (#85)
  • Additional file management methods added to the FileStore class. (#103)
  • You can now pass parameters to a states preload method when switching states. (#104)
  • You can now filter out messages to be logged out when using the Kiwi.Log. (#151)
  • Much better consistency for passing file types. (#156)
  • @rydairegames added a method to get a tile when you know its index. (#160)
  • ArcadePhysics now contains a rotateToVelocity method. (#179)
  • Clocks now contains deltas. (#183)
  • You can now assign floating point values when changing an Animation‘s frame; they will be rounded to the nearest frame. (#186)
  • Audio now contains an onComplete signal. (#189)
  • Context menu events have been added to the Mouse Input Manager. (#191)
  • HUDWidgets can change the origin the position is based on. (#193)
  • New get children by tag methods added to groups. (#195)

Bug Fixes

  • Animation employs more rigorous methods which ensure the frameIndex is correct. (#184)
  • Timer no longer hangs when the interval is set to 0ms. (#187)
  • setInterval and setTimeout now deal with clock units. (#188)
  • IconBar positioning fixed. (#192)
  • Minor fix with the image loading when using the xhr + arraybuffer methods of loading.
  • ArcadePhysics tile collision boxes made smaller to give better collisions.

Special thanks goes out to @rydairegames for providing the getTileFromIndex method. We think it is extremely useful already.

More details can be found on the Kiwi.JS repo under the 1.3.0 milestone.

If you have any questions, or would like to report a bug, please resist the urge to shout, “Curse you, Moriarty!” Instead, visit our website and make use of our growing community!

Hello from Kiwi.JS v1.2.0 “Williams”

Happy New Year from the Kiwi team! Today we are happy to release version 1.2.0 of Kiwi.JS, “Williams”.

This version of Kiwi.JS brings powerful new ways to build and automate game architecture. With a robust Entity Component System, more time controls, faster file loading options, a new debug logging system, unified color format, and more, we reckon you’ll be able to build some seriously pro games.

“Williams” is named in honor of Roberta Williams, creator of the King’s Quest series and one of the great adventure game designers. Where would modern gaming be without Williams? We’re big fans here.

You can download 1.2.0 of Kiwi.JS on github now.

New Features

Kiwi.JS v1.2.0 has several exciting new features. Some of these are so cool that we’ll be doing entire posts on them in the near future. Upcoming articles include:

  • Entity Component System
  • Robust Clocks and Better Animation
  • Kiwi.Log Debug System
  • Color System
  • Revised File Loading System

We’ve also made some smaller improvements that don’t merit their own article. We’ll explain those here.


When an Animation is set to a single repetition, and it successfully completes that repetition, it fires a Signal called onComplete. This is useful for signalling the completion of a single event. It is different from onStop, which may fire upon completion, but will also fire if the Animation is interrupted.

Transform Performance Upgrades

GameObjects must have a Transform to set their position in space. Unfortunately, Transforms use matrix mathematics to do their thing, and this can be costly on low-end CPUs such as those in mobile devices.

We’ve streamlined the Transform process to make it 10-30% faster. In addition, we’ve supplied a couple of useful functions to squeeze even more power out of the Transform.


By default, Transform will get a matrix from its parent. This allows the Transform to follow a parent through any transformation, as though it were part of the parent Transform. Set ignoreParent = true to disable this, gaining some performance back. The entity will still be able to transform, but it will not respect any parent transforms. This is useful if your entity is not part of a Group. Note that the State is also a kind of Group, so if your entity is a child of the State, and the State does not transform, ignoreParent = true is a great way to get a little more oomph.


By default, Transform will update its matrix every frame. Set locked = true to disable this, gaining some performance back. The entity will be locked at its current transform. It will still respect parent transforms. This is useful for objects that don’t change often.

TextField now has a hitbox component. This hitbox is a clever estimate based on expected text dimensions. If you wish to add other components, such as physics or input, the presence of a Box will make it possible.

Game domParent can use CSS Selectors

When specifying the domParent in game options, you can now use CSS Selectors as well as DOM element ids.


Tired of writing long conditionals to figure out whether a number is within bounds? isBetween( x, min, max ) will do the heavy lifting for you. Note that it only returns true if x is genuinely between min and max; if x = min or if x = max, it is not between them and is thus false.

Pointer.pressed, Pointer.released

Pointer (and by extension Finger and MouseCursor) now have pressed and released properties. These are true only on the frame directly after the pointer is pressed or released. This was previously difficult to ascertain if you were creating your own input methods.


You could already call Camera.transformPoint to transform a Point into world coordinates. With transformPointToScreen, you can go the other way. This will tell you where a Point in world space maps to the screen. This can be useful for ascertaining whether something is on screen, positioning HUD elements over game objects, etc.

Reassign Tween.object

There is now a setter that permits you to reassign Tween.object midway through a Tween. This will immediately stop updating the current object. The new object will inherit the current value of any tweening value. Any tweening value that is not present on the new object will be removed from the Tween. This could be useful for substituting one object for another midway through a Tween, as in a transformation sequence or an entity suffering battle damage.

TextField name

What’s wrong with “Textfield”? It’s not properly camel-cased: it should read “TextField”. We’ve added the correct name as an alias. Old code will still work, but new code may be written in a more pleasing fashion.

Release Notes

v1.2.0 "Williams"

New Features

  • Pro architecture tools out the wazoo
  • All Component objects on a Group or Entity will automatically update when the State updates. This permits a full Entity Component System. (#122)
  • Clock greatly improved (#143)
    • Time can run at any rate, in any direction
    • rate property available on clocks
    • Animation, Tween, and TweenManager use new clock abilities
  • Animation has a Signal called onComplete which fires after finishing (#143)
  • Kiwi.Log added. This replaces and upgrades console.log functionality, with recording, tagging, and selective muting. It’s a big step up for debug! (#117)
  • Kiwi.Utils.Color object can record and output color values in a very wide range of formats, including RGB, RGBA, HSL, HSV, CSS color functions, and normalized or integer values. (#135)
  • File system is more flexible
    • Parallel loading option for lightning-fast downloads
    • Load files with easy-to-use parameters
    • Easily manage state-specific files
  • Transform optimisations (#141)
    • Improved performance
    • Transform may be set lock = true to prevent updates and increase performance
    • Transform may be set ignoreParents = true to save performance with objects whose parents don't update
  • TextField now has a hitbox (#137)
  • Game domParent parameter can now use CSS selectors (#131)
  • Kiwi.Utils.Common.between( x, a, b ) method added. It's much faster to check if something is between two numbers now. (#118)
  • Input.Pointers now has pressed and released getters, allowing you to see if a mouse or finger was pressed or released in the last frame only. (#115)
  • Camera.transformPointToScreen added, allowing you to translate world points to screen coordinates. This is the opposite of Camera.transformPoint. (#112)
  • You may now reassign Tween.object, transferring a Tween from one object to another. (#109)
  • State.loadProgress() can now estimate bytes loaded (#66)
  • Timer Helpers implemented. You can now call Clock.setInterval and Clock.setTimeout, rather than mess around with three or more calls to get the same effect. These helpers run on game clocks, and will respect clock manipulation and pausing. (#44)

Bug Fixes

  • XHR loading works with Nodewebkit where status codes are unavailable (#144)
  • Kiwi.Utils.Common.defaultToString is now in camelCase (#140)
  • TileMapLayer.getOverlappingTiles now works correctly with negative coordinates (#139)
  • Kiwi.Time.Clock.removeTimer works correctly (#138)
  • Audio objects now loop correctly after being paused and resumed (#132)
  • PluginManager now correctly allows requirements that match or exceed requested version number, rather than those that match or precede it. (#130)
  • Game prints the correct error message when no stage was specified, or an incorrect stage was specified. (#129)
  • Mouse events now include button data. (#126)
  • AnimationManager now calls onUpdate after changing cellIndex, ensuring that callbacks have more accurate data regarding cells. (#125)
  • StaticImage.objType() now reports "StaticImage" instead of "Sprite" (#119)
  • Spritesheet texture atlas correctly enumerates number of cells. (#116)
  • Timer resumes where it left off after being paused (#113)
  • File loader now correctly interprets files without extensions in CocoonJS (#106)

Deprecations and Removals

  • Textfield is deprecated in favour of TextField alias (#134)
  • Kiwi.Utils.Common.defaultToString is now in camelCase (#140)

Project Architecture

  • Switched to Typescript 1.4. Run npm update to upgrade your packages.

More details can be found on the Kiwi.JS repo under the 1.2.0 milestone