Skip to content

Commit

Permalink
Track time since explosion for replicable animations, see #344
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jun 16, 2020
1 parent f173220 commit ad908f2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/common/model/Body.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ class Body extends PhetioObject {
phetioDocumentation: 'The distance across the body',
phetioReadOnly: true
} );
this.clockTicksSinceExplosionProperty = new Property( 0 );

this.clockTicksSinceExplosionProperty = new NumberProperty( 0, {
tandem: tandem.createTandem( 'clockTicksSinceExplosionProperty' ),
phetioDocumentation: 'For internal use only',
phetioReadOnly: true
} );
this.boundsProperty = new Property( new Bounds2( 0, 0, 0, 0 ) );

options = merge( {
Expand Down Expand Up @@ -263,7 +268,7 @@ class Body extends PhetioObject {
this.userModifiedVelocityEmitter = new Emitter();

this.isCollidedProperty.link( collided => {
if ( collided ) {
if ( collided && !phet.joist.sim.isSettingPhetioStateProperty.value ) {
this.clockTicksSinceExplosionProperty.set( 0 );
}
} );
Expand Down

0 comments on commit ad908f2

Please sign in to comment.