bard-legends-framework 0.1.31 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@ class ImmovablePhysicsEntity extends physics_entity_1.PhysicsEntity {
19
19
  position: this.position,
20
20
  rotation: this.rotation,
21
21
  velocity: { x: 0, y: 0 },
22
- angularVelocity: 0
22
+ rotationalSpeed: 0
23
23
  };
24
24
  }
25
25
  }
@@ -5,6 +5,6 @@ export declare abstract class MovableEntity extends Entity {
5
5
  readonly position: Variable<Vec2>;
6
6
  readonly rotation: Variable<number>;
7
7
  readonly velocity: Variable<Vec2>;
8
- readonly angularVelocity: Variable<number>;
8
+ readonly rotationalSpeed: Variable<number>;
9
9
  update(time: number, delta: number): void;
10
10
  }
@@ -9,14 +9,14 @@ class MovableEntity extends game_entities_1.Entity {
9
9
  this.position = new actions_lib_1.Variable().set({ x: 0, y: 0 });
10
10
  this.rotation = new actions_lib_1.Variable().set(0);
11
11
  this.velocity = new actions_lib_1.Variable().set({ x: 0, y: 0 });
12
- this.angularVelocity = new actions_lib_1.Variable().set(0);
12
+ this.rotationalSpeed = new actions_lib_1.Variable().set(0);
13
13
  }
14
14
  update(time, delta) {
15
15
  this.position.value = {
16
16
  x: this.position.value.x + this.velocity.value.x * delta,
17
17
  y: this.position.value.y + this.velocity.value.y * delta
18
18
  };
19
- this.rotation.value = this.rotation.value + this.angularVelocity.value * delta;
19
+ this.rotation.value = this.rotation.value + this.rotationalSpeed.value * delta;
20
20
  }
21
21
  }
22
22
  exports.MovableEntity = MovableEntity;
@@ -7,12 +7,12 @@ export declare abstract class MovablePhysicsEntity extends PhysicsEntity {
7
7
  readonly position: Variable<Vec2>;
8
8
  readonly rotation: Variable<number>;
9
9
  readonly velocity: Variable<Vec2>;
10
- readonly angularVelocity: Variable<number>;
10
+ readonly rotationalSpeed: Variable<number>;
11
11
  readonly onCollision: Action<CollisionReport[]>;
12
12
  private ignorePositionUpdate;
13
13
  private ignoreRotationUpdate;
14
14
  private ignoreVelocityUpdate;
15
- private ignoreAngularVelocityUpdate;
15
+ private ignoreRotationalSpeedUpdate;
16
16
  constructor(physicsWorld: PhysicsWorld, physicsEntityDefinition: PhysicsEntityDefinition);
17
17
  convertToDTO(): PhysicsBodyDTO;
18
18
  private step;
@@ -10,12 +10,12 @@ class MovablePhysicsEntity extends physics_entity_1.PhysicsEntity {
10
10
  this.position = new actions_lib_1.Variable().set({ x: 0, y: 0 });
11
11
  this.rotation = new actions_lib_1.Variable().set(0);
12
12
  this.velocity = new actions_lib_1.Variable().set({ x: 0, y: 0 });
13
- this.angularVelocity = new actions_lib_1.Variable().set(0);
13
+ this.rotationalSpeed = new actions_lib_1.Variable().set(0);
14
14
  this.onCollision = new actions_lib_1.Action();
15
15
  this.ignorePositionUpdate = false;
16
16
  this.ignoreRotationUpdate = false;
17
17
  this.ignoreVelocityUpdate = false;
18
- this.ignoreAngularVelocityUpdate = false;
18
+ this.ignoreRotationalSpeedUpdate = false;
19
19
  this.phsicsToLocalSync();
20
20
  this.localToPhsicsSync();
21
21
  this.physicsWorld.onPhysicsStep.subscribe(({ time, delta }) => this.step(time, delta)).attach(this);
@@ -27,21 +27,21 @@ class MovablePhysicsEntity extends physics_entity_1.PhysicsEntity {
27
27
  position: this.position.value,
28
28
  rotation: this.rotation.value,
29
29
  velocity: this.velocity.value,
30
- angularVelocity: this.angularVelocity.value
30
+ rotationalSpeed: this.rotationalSpeed.value
31
31
  };
32
32
  }
33
33
  step(time, delta) {
34
34
  this.ignorePositionUpdate = true;
35
35
  this.ignoreRotationUpdate = true;
36
36
  this.ignoreVelocityUpdate = true;
37
- this.ignoreAngularVelocityUpdate = true;
37
+ this.ignoreRotationalSpeedUpdate = true;
38
38
  this.phsicsToLocalSync();
39
39
  }
40
40
  phsicsToLocalSync() {
41
41
  this.position.value = p2js_helper_1.P2JSHelper.arrayToVec2(this.body.position);
42
42
  this.rotation.value = this.body.angle;
43
43
  this.velocity.value = p2js_helper_1.P2JSHelper.arrayToVec2(this.body.velocity);
44
- this.angularVelocity.value = this.body.angularVelocity;
44
+ this.rotationalSpeed.value = this.body.angularVelocity;
45
45
  }
46
46
  localToPhsicsSync() {
47
47
  this.position
@@ -74,13 +74,13 @@ class MovablePhysicsEntity extends physics_entity_1.PhysicsEntity {
74
74
  }
75
75
  })
76
76
  .attach(this);
77
- this.angularVelocity
78
- .subscribe(angularVelocity => {
79
- if (this.ignoreAngularVelocityUpdate) {
80
- this.ignoreAngularVelocityUpdate = false;
77
+ this.rotationalSpeed
78
+ .subscribe(rotationalSpeed => {
79
+ if (this.ignoreRotationalSpeedUpdate) {
80
+ this.ignoreRotationalSpeedUpdate = false;
81
81
  }
82
82
  else {
83
- let torque = (angularVelocity - this.body.angularVelocity) / this.body.invInertia;
83
+ let torque = (rotationalSpeed - this.body.angularVelocity) / this.body.invInertia;
84
84
  this.body.angularForce = torque;
85
85
  }
86
86
  })
@@ -35,7 +35,7 @@ export interface PhysicsBodyDTO {
35
35
  readonly position: Vec2;
36
36
  readonly rotation: number;
37
37
  readonly velocity: Vec2;
38
- readonly angularVelocity: number;
38
+ readonly rotationalSpeed: number;
39
39
  }
40
40
  export interface CollisionDetails {
41
41
  readonly body: PhysicsBodyDTO;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bard-legends-framework",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Bard Legends Framework",
5
5
  "main": "dist/index.js",
6
6
  "repository": {