Skip to content

Releases: sporeball/victus

0.12.0

12 Jun 00:19
Compare
Choose a tag to compare

more than 2 years after the most recent patch, victus 0.12.0 is here! it's the biggest victus update ever, and not in terms of the file size - in fact, quite the opposite, as this build is less than 1400 bytes in size!

features

file size improvements

  • builds are now crushed using the brilliant JSCrush algorithm, saving nearly 1000 bytes.
  • a 3-byte-per-key version of JS1k's time-honored canvas context hash trick is now used internally, saving 33 bytes before crushing.
  • Primitive.clone() is now just 2 lines long.
  • countless other byte saves all over the framework.

new stuff

  • the Primitive class has been added to the victus object, allowing for the creation of custom classes which extend it.
  • new rotation features are now available, including an rv property for rotational velocity as well as rotateTo() and rotateBy() methods.
  • the Rect, Ellipse, and Sprite classes now include a path property, allowing for the use of CanvasRenderingContext2D.isPointInPath().
  • the keys object has been completely refactored, and now exposes press and held properties for every key returned by KeyboardEvent.key.

quality of life

  • the canvas context is now simply exposed as victus.ctx.
  • the Sprite.spr, Sound.vol, and Sound.loop properties can now be set directly.
  • Sound.vol is now optional (defaults to 1).

bugfixes

  • the let keyword is now used instead of var (#1).
  • Primitive.xv and Primitive.yv are now in pixels per second, not pixels per frame.
  • Primitive.ax and Primitive.ay are now relative to the top left corner of the canvas, not the top left corner of the primitive.
  • the anchor point of a primitive will now move when the primitive does.
  • Ellipse instances are now drawn with the correct radii.
  • Sound.reset() now sets the sound's currentTime property to 0 instead of reloading the whole sound.

other changes

  • a test directory has been created.
  • certain keywords and method names have been changed; see the 0.11.2 → 0.12.0 migration guide for more information.

0.11.2 → 0.12.0 migration guide

  • because of the change in units of Primitive.xv and Primitive.yv, these values should now be divided by 60.
  • also note the change to Primitive.ax and Primitive.ay, and change relevant code accordingly.
  • the Primitive.setProps() method has been changed to Primitive.set().
  • the Primitive.rotation property has once again been changed to Primitive.r.

0.11.2

30 Mar 04:02
Compare
Choose a tag to compare

this patch simply serves to update the main description of victus from "a JavaScript library for canvas games" to "a zero-dependency JavaScript game framework", as well as revise victus' README and keywords. there are no new features added.

0.11.1

16 Oct 20:59
Compare
Choose a tag to compare

release notes

this patch contains 200+ bytes of optimizations over 0.11.0. there are no new features added.

  • the constructors for the Sprite and Sound classes, as well as the clone() function, have been optimized to remove unnecessary redundancies.
  • the ax and ay properties, which hold the true anchor point of an object, are now not stored, and only calculated when they are needed.
  • the keyword this is aliased to t wherever it makes sense, saving 3 bytes for each usage.
  • minor optimizations elsewhere.

0.11.0

24 Aug 09:29
Compare
Choose a tag to compare

with the release of this version, victus will temporarily be entering a feature freeze so that i can focus on writing full documentation and completing victus' website. my thanks to anyone who's used it thus far.

features

  • the object passed to setProps() will now accept any key, allowing you to add custom properties to a primitive.
  • pass an object as the last parameter when creating a Rect, Ellipse or Sprite, and setProps() will be run on it with the object's keys and values. passing an object to clone() will work the same way.
  • massively optimized the logic behind hiding and showing objects.
    • in addition to hide() and show(), you can now change an object's hidden property directly, if you prefer.

bugfixes

  • setting an object's col property will now immediately change its color, as was intended.
  • hidden objects are now not drawn, instead of being drawn with the background color of the canvas. this should prevent unintended behavior if you draw a hidden object on top of a visible one.

other changes

  • small optimizations elsewhere.

0.10.0

18 Aug 02:42
Compare
Choose a tag to compare

this is the release i've been holding in my back pocket for the majority of 2020.

features

  • rotation should now work like a charm for all primitives — not just sprites.
    • set the rotation property of an object after constructing it, and it'll be rotated by that many degrees around its current anchor point. this property was previously called r, but has been changed for clarity.
    • the default anchor point of an object is its center, where (0, 0) is the object's top left corner. for a Rect with a width and height of 20, the default anchor point is (10, 10).
    • the components of an object's anchor point are exposed as anchorX and anchorY. alternatively, set both at once by calling anchor() on it.
  • added a setProps() function to all primitives. pass it an object, and any properties for which the object contains a key will be changed to that key's value.

other changes

  • creating the keys object now takes less bytes.

0.9.2

21 Dec 05:02
Compare
Choose a tag to compare

release notes

  • there are no new changes in this version.
    instead this tag serves as a patch to temporarily roll back broken code related to sprite origin and rotation that was added in the previous version.

0.9.0

20 Dec 03:09
Compare
Choose a tag to compare

features

  • all versions starting with this one will no longer require browserify, making builds 250+ bytes smaller. because of this change, victus.bundle.min.js has been renamed to victus.min.js.
  • victus has mouse support now, too, thanks to the new victus.mouse object!
    the new object contains keys x and y to keep track of mouse position, plus click for detecting a mouse click and held for keeping track of whether the left mouse button is held down.
  • added sprite rotation. set the r property of a sprite after constructing it, and it'll be rotated by that many degrees.
    this feature will be coming to the other primitives in the near future.

other changes

  • all primitives now have a function o() which you can use to set its origin (center of rotation); however, it currently has no effect unless the primitive is a sprite.
  • minor byte saves.

0.8.0

17 Dec 16:49
Compare
Choose a tag to compare

release notes

features

  • victus has keyboard support now! use the newly added victus.keys object with the keyup and keydown event listeners, and you can check for user input.
    the new object contains a value for every letter of the alphabet, as well as the values LeftArrow, UpArrow, RightArrow, and DownArrow.

other changes

  • removed the interaction check for sounds, as it was a little redundant.

0.7.0

14 Dec 21:35
Compare
Choose a tag to compare

release notes

this tag marks the first official release of victus!

features

  • the keyword sprite in the constructor for the Sprite class has been changed to spr.
  • added hide() and show() functions to all objects.
    hidden objects are drawn using the background color of the canvas until you decide to show them again.
    note that if you clone() a hidden object, the clone will also be hidden until you use show() on it.
  • need to use a drawing function that victus doesn't provide? now you can write custom ones! the context of the canvas is now exposed to your scripts as x().

bugfixes

  • sounds now reset themselves whenever they're played. this should allow you to play the same sound multiple times in quick succession.

0.6.0

12 Dec 03:42
Compare
Choose a tag to compare
0.6.0 Pre-release
Pre-release

release notes

features

  • some keywords used on setup and when dealing with objects have changed, and are now a bit shorter:
    • width and height are now w and h
    • clearColor is now color
    • color is now col
    • xVelocity and yVelocity are now xv and yv
    • string is now str
  • in a similar fashion, certain private functions no longer contain an underscore.
  • added a Sound class, with built-in methods for playing, pausing and resetting a sound. note that sounds will not play unless the page has already been explicitly clicked or tapped on.