Skip to content

Commit

Permalink
3.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
quinton-ashley committed Apr 10, 2024
1 parent 44baef6 commit a08cd37
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
7 changes: 7 additions & 0 deletions p5play.d.ts
Expand Up @@ -939,6 +939,13 @@ class Sprite {
* @default {x: 0, y: 0}
*/
get velocity(): p5.Vector;
set gravityScale(val: number);
/**
* A ratio that defines how much the sprite is affected by gravity.
* @type {Number}
* @default 1
*/
get gravityScale(): number;
/**
* If this function is given a force amount, the force is applied
* at the angle of the sprite's current bearing. Force can
Expand Down
17 changes: 16 additions & 1 deletion p5play.js
Expand Up @@ -2759,6 +2759,20 @@ p5.prototype.registerMethod('init', function p5playInit() {
this.vel = val;
}

/**
* A ratio that defines how much the sprite is affected by gravity.
* @type {Number}
* @default 1
*/
get gravityScale() {
return this.body?.getGravityScale();
}
set gravityScale(val) {
if (!this.body) return;
if (this.watch) this.mod[44] = true;
this.body.setGravityScale(val);
}

_update() {
if (this._ani?.update) this._ani.update();

Expand Down Expand Up @@ -4068,7 +4082,8 @@ p5.prototype.registerMethod('init', function p5playInit() {
textSize: 'number', // 40
textStroke: 'color', // 41
textStrokeWeight: 'number', // 42
opacity: 'number' // 43
opacity: 'number', // 43,
gravityScale: 'number' // 44
};

$.Sprite.props = Object.keys($.Sprite.propTypes);
Expand Down
2 changes: 1 addition & 1 deletion p5play.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -49,5 +49,5 @@
"version": "git add -A",
"postversion": "git push"
},
"version": "3.21.3"
"version": "3.21.4"
}

0 comments on commit a08cd37

Please sign in to comment.