Releases: sporeball/victus
Releases · sporeball/victus
0.12.0
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 thevictus
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 asrotateTo()
androtateBy()
methods. - the
Rect
,Ellipse
, andSprite
classes now include apath
property, allowing for the use ofCanvasRenderingContext2D.isPointInPath()
. - the
keys
object has been completely refactored, and now exposespress
andheld
properties for every key returned byKeyboardEvent.key
.
quality of life
- the canvas context is now simply exposed as
victus.ctx
. - the
Sprite.spr
,Sound.vol
, andSound.loop
properties can now be set directly. Sound.vol
is now optional (defaults to 1).
bugfixes
- the
let
keyword is now used instead ofvar
(#1). Primitive.xv
andPrimitive.yv
are now in pixels per second, not pixels per frame.Primitive.ax
andPrimitive.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'scurrentTime
property to0
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
andPrimitive.yv
, these values should now be divided by 60. - also note the change to
Primitive.ax
andPrimitive.ay
, and change relevant code accordingly. - the
Primitive.setProps()
method has been changed toPrimitive.set()
. - the
Primitive.rotation
property has once again been changed toPrimitive.r
.
0.11.2
0.11.1
release notes
this patch contains 200+ bytes of optimizations over 0.11.0. there are no new features added.
- the constructors for the
Sprite
andSound
classes, as well as theclone()
function, have been optimized to remove unnecessary redundancies. - the
ax
anday
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 tot
wherever it makes sense, saving 3 bytes for each usage. - minor optimizations elsewhere.
0.11.0
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
orSprite
, andsetProps()
will be run on it with the object's keys and values. passing an object toclone()
will work the same way. - massively optimized the logic behind hiding and showing objects.
- in addition to
hide()
andshow()
, you can now change an object'shidden
property directly, if you prefer.
- in addition to
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
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 calledr
, 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
andanchorY
. alternatively, set both at once by callinganchor()
on it.
- set the
- 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
0.9.0
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 tovictus.min.js
. - victus has mouse support now, too, thanks to the new
victus.mouse
object!
the new object contains keysx
andy
to keep track of mouse position, plusclick
for detecting a mouse click andheld
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
release notes
features
- victus has keyboard support now! use the newly added
victus.keys
object with thekeyup
andkeydown
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 valuesLeftArrow
,UpArrow
,RightArrow
, andDownArrow
.
other changes
- removed the interaction check for sounds, as it was a little redundant.
0.7.0
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 tospr
. - added
hide()
andshow()
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 youclone()
a hidden object, the clone will also be hidden until you useshow()
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
release notes
features
- some keywords used on setup and when dealing with objects have changed, and are now a bit shorter:
width
andheight
are noww
andh
clearColor
is nowcolor
color
is nowcol
xVelocity
andyVelocity
are nowxv
andyv
string
is nowstr
- 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.