Skip to content

Releases: straker/kontra

v10.0.2

25 Aug 04:30
Compare
Choose a tag to compare
  • fix(GameObject): render properly when tracked by pointer

v10.0.1

21 Aug 02:49
Compare
Choose a tag to compare
  • fix(spriteSheet): actually default margin and spacing to 0

v10.0.0

09 Aug 03:45
Compare
Choose a tag to compare

Migrates the seedRand and randInt functions to a new PRNG module. In so doing this breaks how seedRand and randInt works. It also updated the PRNG algorithm to use SplitMix32 instead of LCG and the string hashing algorithm from xfnv1a to MurmurHash3.

This release also updates TileEngine to support spacing property and renames the frameMargin property to margin and updates it to mean margin around the tilesheet instead of margin between each frame.

Breaking Changes

  • seedRand: no longer returns rand as a function but instead modifies the seed
  • tileEngine: frameMargin renamed to margin and means margin around the tilesheet

Features

  • seedRand: also now accepts a string or defaults to the current time if no value is passed
  • randInt: accepts a function as 3rd parameter which can be used to pass a function that can bias the random number
  • randInt: uses rand function by default instead of Math.random so is affected by seeding the PRNG
  • rand: function that returns a seeded random number between 0 and 1
  • getSeed: function that returns the current random seed value
  • button,scene: expose the HTML node property
  • gameObject: add angular velocity and acceleration
  • tileEngine: support flipped and rotated tiles in Tiled
  • tileEngine: support the spacing property for the whitespace between frames
  • button: allow adding the HTMLButton element to a container
  • tileEngine: add getPosition function

Fixes

  • gameLoop: prevent zombie frame when start is called twice
  • gameLoop: emit tick event every update
  • prevent scrolling page on element focus

v9.0.0

27 Jan 03:56
Compare
Choose a tag to compare

The angleToTarget helper class was returning the wrong angle due to an incorrect use of sin and cos, resulting in adding a quarter rotation. This has been fixed which causes a breaking change from the value that was returned before (no longer adds a quarter rotation).

Breaking Changes

  • helpers: return correct angle from angleToTarget

Features

  • vector: add direction function
  • vector: add set function and allow initialize with object
  • text: add text stroke
  • gamepad: pass buttonName as extra param to gamepad callback
  • animation: add start and stop functions ,isStopped property

Fixes

  • tileEngine: Add TileEngineClass to exports
  • gameObject: clamp opacity between 0 and 1
  • keyboard: allow keyPressed to accept array of keys
  • vector: handle normalizing zero vector
  • text: correctly handle string with both newlines and a fixed width
  • allow objects to be created before init
  • pointer: correctly track objects when scene/tileEngine camera is moved
  • tileEngine: prevent negative sx/sy when map size is smaller than canvas size

v8.0.0

13 Feb 04:58
Compare
Choose a tag to compare

Many properties and functions have been renamed to better align the various APIs and support the new Input wrapper API. Also to support building the library with esbuild all .prototype and .class properties were removed and replaced with the new *Class export (e.g. import { SpriteClass } from 'kontra')

Breaking Changes

  • removed .prototype and .class properties of each factory export
  • sprite: removed sx and sy properties from GameObject
  • keyboard: renamed bindKeys andunbindKeys to onKey and offKey (respectively)
  • keyboard: renamed keyboard keys up, down, left, right to arrowup, arrowdown, arrowleft, arrowright (respectively)
  • pointer: removed onPointerDown and onPointerUp and replaced with onPointer (e.g. onPointer('down', callback))
  • gameObject: removed filterFunction from render
  • helpers: do not return null on rotated object for collides
  • scene: rename children, addChild, and removeChild to objects, add, and remove (respectively)

Features

  • gesture: add swipe and pinch gesture support
  • gamepad: add gamepad api
  • input: add input wraper api
  • button: button can be disabled when created @alfi-s
  • allow esbuild to tree shake library @anderoonies
  • tileEngine: add preprocessor support for TileEngine
  • helpers: add movePoint function
  • grid: allow setting alignment for individual rows or cols, allow setting children
  • core: allow contextless environment
  • tileEngine, gameObject: remove camera from sprite, have tileEngine render all objects
  • pointer: add offPointer function
  • scene,helpers: allow scene to sort chlidren. add depthSort helper

Bug Fixes

  • Text cast value to string when setting Text.text @anderoonies
  • grid work with colSpan > 2
  • grid take into account child world width and height
  • srOnly add clip to sr only style
  • sprite translate by camera position before rotation
  • gameObject correctly calculate world position when nested children are rotated
  • ts fix load and loadData types to accept array

v7.3.1

03 Sep 21:57
Compare
Choose a tag to compare

feat(assets): support webp images

v7.2.0

19 Aug 03:06
Compare
Choose a tag to compare
  • feat(gameLoop): do not update loop when tab is blurred
  • feat(keyboard): preventDefault for all bound keys
  • feat(pointer): initPointer can change radius
  • fix(types): make "dt" always exist in update @sheepsteak
  • fix(utils): update srOnlyStyles
  • fix(grid): reverse colGap when dir=rtl

v7.1.3

20 Mar 02:48
Compare
Choose a tag to compare
  • fix(keyboard): allow keyup support for bindKeys
  • fix(text): cast text to string
  • fix(helpers/getWorldRect): work with tileEngine

v7.1.2

23 Aug 16:03
Compare
Choose a tag to compare
  • fix(helpers.getWorldRect): adjust for negative scale values

v7.1.1

20 Aug 03:55
Compare
Choose a tag to compare
  • fix: properly export helpers.rotatePoint()