Revert "Add bounce event to arcade physics Fix #6406"

This reverts commit 542bac2d02.
This commit is contained in:
Robert Kowalski 2024-02-21 07:22:57 -05:00
parent 4a85524425
commit 9d155d8dde
5 changed files with 0 additions and 61 deletions

View file

@ -486,16 +486,6 @@ var Body = new Class({
*/ */
this.onOverlap = false; this.onOverlap = false;
/**
* Whether the simulation emits an `bounce` event when this Body bounces.
*
* @name Phaser.Physics.Arcade.StaticBody#onBounce
* @type {boolean}
* @default false
* @since 3.80.0
*/
this.onBounce = false;
/** /**
* The absolute maximum velocity of this body, in pixels per second. * The absolute maximum velocity of this body, in pixels per second.
* The horizontal and vertical components are applied separately. * The horizontal and vertical components are applied separately.
@ -1232,11 +1222,6 @@ var Body = new Class({
var blocked = this.blocked; var blocked = this.blocked;
this.world.emit(Events.WORLD_BOUNDS, this, blocked.up, blocked.down, blocked.left, blocked.right); this.world.emit(Events.WORLD_BOUNDS, this, blocked.up, blocked.down, blocked.left, blocked.right);
if (this.onBounce && this.bounce.length())
{
this.emit(Events.BOUNCE, this);
}
} }
}, },

View file

@ -295,17 +295,6 @@ var StaticBody = new Class({
*/ */
this.onOverlap = false; this.onOverlap = false;
/**
* Whether the simulation emits an `bounce` event when this StaticBody bounces.
* Always false for a Static Body. (Static Bodies never bounce and never trigger a `bounce` event.)
*
* @name Phaser.Physics.Arcade.StaticBody#onBounce
* @type {boolean}
* @default false
* @since 3.80.0
*/
this.onBounce = false;
/** /**
* The StaticBody's inertia, relative to a default unit (1). With `bounce`, this affects the exchange of momentum (velocities) during collisions. * The StaticBody's inertia, relative to a default unit (1). With `bounce`, this affects the exchange of momentum (velocities) during collisions.
* *

View file

@ -1469,16 +1469,6 @@ var World = new Class({
else if (body1.onCollide || body2.onCollide) else if (body1.onCollide || body2.onCollide)
{ {
this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2);
if (body1.onBounce && body1.bounce.length())
{
this.emit(Events.BOUNCE, body1);
}
if (body2.onBounce && body2.bounce.length())
{
this.emit(Events.BOUNCE, body2);
}
} }
} }

View file

@ -1,24 +0,0 @@
/**
* @author Richard Davey <rich@phaser.io>
* @copyright 2013-2024 Phaser Studio Inc.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* The Arcade Physics World Bounce Event.
*
* This event is dispatched by an Arcade Physics World instance if a body collides with a body or world bounds
* _and_ it has its [onBounce]{@link Phaser.Physics.Arcade.Body#onBounce} property set to `true` while having
* a bounce magnitude above 0.
*
* It provides an alternative means to handling collide events rather than using the callback approach.
*
* Listen to it from a Scene using: `this.physics.world.on('bounce', listener)`.
*
* @event Phaser.Physics.Arcade.Events#BOUNCE
* @type {string}
* @since 3.80.0
*
* @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body that bounced.
*/
module.exports = 'bounce';

View file

@ -10,7 +10,6 @@
module.exports = { module.exports = {
BOUNCE: require('./BOUNCE_EVENT'),
COLLIDE: require('./COLLIDE_EVENT'), COLLIDE: require('./COLLIDE_EVENT'),
OVERLAP: require('./OVERLAP_EVENT'), OVERLAP: require('./OVERLAP_EVENT'),
PAUSE: require('./PAUSE_EVENT'), PAUSE: require('./PAUSE_EVENT'),