Skip to content

v3.16

Compare
Choose a tag to compare
@quinton-ashley quinton-ashley released this 08 Nov 15:25
· 111 commits to main since this release

v3.16.6

Discord user @ zeebeejeebee pointed out that this use case was previously supported new Sprite(x, y, colliderType) but I had forgot that was a valid use. Just added it back!

Also I better documented all the different ways the Sprite constructor can be used.

v3.16.5

Earlier I upgraded the setter for sprite.collider so that it would not destroy the sprite's body and instead use the new planck function body.setType, which is a much more efficient way to do it, but this change had a lot of unintended consequences. In the process of fixing the issues I refactored the Sprite constructor, which was a total mess! There was lots of duplicate code in the Sprite constructor and sprite.addCollider which I consolidated and organized better.

Additional fix for reflexive group contact handling so it can work when called after the group's sprites are created.
groupA.overlaps(groupA)

Fixed issue where only setting group.width and not group.height would make new GroupSprites be circles, when they should be boxes.

Updated the setter for sprite.shape which no longer destroy's the sprite's physics body, it removes the sprite's fixtures, then creates new ones based on the desired shape. The sprite's mass is now recalculated if the sprite's shape changes, this was in the documentation but by mistake had not actually been implemented.

v3.16.4

Fixed issue changing a "none" collider with a "circle" shape to any non-"none" collider type.

v3.16.3

SpriteAnimation set frame now throws an error if the user tries to set a frame value that's too high (or low).

v3.16.2

Breaking change to a previously undocumented feature, world.offset which is now called world.origin because it doesn't behave the same as sprite.offset, it just sets where the origin (0, 0) of the world is on the canvas, effectively translating every sprite. Also the physics world doesn't have a size, so it was misleading to have world.hw and world.hh (half-width and half-height) properties, those are now properties of the p5 canvas.

v3.16.1

The new contact handling system did have one issue I hadn't tested for.

Just fixed reflexive group contact handling, where a contact handler is set between members of a group.

groupA.overlaps(groupA, cb);

Used in Fruit 2048:
https://arissazh.github.io/final-project/

v3.16.0

This update contains mostly internal changes (refactoring 🧼). I rewrote a big part of p5play's contact handling system... again. 🐳 But I think I've finally cracked it with the perfect mix of good performance, memory efficiency, and much more readable code.

Also, it's now possible to set a group contact (collision or overlap) handler and then additional contact handler between group members. I don't know how useful this feature will actually be but it is what users would expect. I achieved this new capability by doing another overhaul of how contact relationships, collisions and overlaps, are implemented internally.

I added a ton of contact handling Jest tests to the Sprite.test.js and Group.test.js files to try to ensure this implementation is correct. 🤞🏻