v3.2
v3.2.21
- added a reference page for the sprite rotation methods
rotate
,rotateTo
,rotateTowards
https://p5play.org/learn/sprite.html?page=7 - fixed the hourglass demo, now it doesn't lose a grain of sand! https://p5play.org/demos/?file=hourglass.js
- fixed #230 and #231
- fixed bug in the previous version (v3.2.20) that caused new Sprite not working in the p5.js preload function.
textSize()
doesn't exist until the canvas is created, I didn't know that!
v3.2.12
Bug fixes!
v3.2.6
There are now three distinct movement functions: move
(in a direction, at a fixed speed, across a distance), moveTo
(to a position, at a fixed speed), and moveTowards
(towards a position, at a percentage of the distance to that point). Check them out here: https://p5play.org/learn/sprite.html?page=2
v3.2.2
Any arrow function added to a group will be used as a property setter that will be evaluated when a new sprite from that group is created. https://p5play.org/learn/group.html?page=1 This will work for custom properties now, not just the p5.play sprite properties! To add a function to a Group use the function
keyword.
Also the moveTowards
function can now accept any object with (x,y) properties.
enemies = new Group();
enemies.health = () => random(50, 70);
enemies.attack = function () {
enemies.moveTowards(player);
}
v3.2.1
I added a new mode to the Sprite constructor for making regular polygons!
// ( x, y, sideLength, polygonName)
new Sprite(250, 100, 80, 'pentagon');
See the updated reference page for more info: http://p5play.org/learn/sprite.html?page=8
v3.2.0
p5.play is now available on Open Processing! Follow me (Quinton Ashley) if you'd like to see what I'll be making with p5.play and I'll follow you back. https://openprocessing.org/user/350295?o=6&view=sketches
I've updated how chain and polygon sprites can be created using the Sprite constructor. There are now three different modes: vertex, distance, and line! For more info see the updated reference page: https://p5play.org/learn/sprite.html?page=7
I also added auto-correcting to user input functions so case insensitive input strings can be used. In previous versions the following boolean condition would always return false, regardless of if the Enter key or left mouse button was pressed. Now It just works!
(kb.presses('enter') || mouse.presses('LEFT'))
v3.1.5
Fixed a bug in the p5.play loadImage
function that caused the p5.js internal preloadCount
(the count of images, JSON, and other data being loaded in the preload function) to go down by two instead of one when using the addAni
function, which would cause p5.js to run the setup function before other preload content had finished loading.
v3.1.4
- replaced the sprite and group property
shapeColor
(deprecated) withcolor
because it's also used for chains colliders which have lines and not shapes - changed
colliding
andoverlapping
to return frame counts of how long the collision or overlap has occurred (which are truthy values in JS so they can still be treated like booleans in if statements) - updated the website to have separate pages for collision and overlap function explanations
https://p5play.org/learn/sprite.html?page=5
https://p5play.org/learn/sprite.html?page=6
v3.1.2
CRITICAL fixes for the collided
and overlapped
functions which were not working correctly. Also I fixed the input held
function so that it only returns true if the user releases an input after it was held for 12 frames or longer.
v3.1.0
This update contains changes to the input system. I'm sorry to make these changes kind of late in p5.play v3's development but I think it's important p5.play uses the same verb conjugations for all timing related functions.
I was inspired to make these changes because I'm adding a new paradigm for custom collide and overlap event handling that won't require the use of callback functions and can be used in if
statements. This feature has been highly requested by my students!
In technical terms, single frame initiative timing functions will use present simple tense naming. Continuous timing functions will use present continuous tense naming. Single frame cessation timing functions will use past simple tense naming. For example collides
, colliding
, and collided
. This will allow users greater control over customizing collision and overlap event response!
The past tense function, pressed
, will become an alternative to released
. presses
will return true on the first frame the user presses an input. holds
will return true when the users holds an input for 12 frames (by default). The mouse functions for detecting hovering will be changed to hovers
, hovering
, and hovered
.
Here is an example of the new collides
function in action. The "old way" will still work too.
// old way
player.collide(block, () => {
block.remove();
});
// new way
if (player.collides(block)) {
block.remove()
}
collides
returns true on the first frame a sprite collides with a target sprite, colliding
returns true while a sprite collides with a target, and collided
returns true on the frame when contact between the sprite and target ends. overlaps
, overlapping
, and overlapped
functions will be available too.