Skip to content

Commit

Permalink
remove all instances of Rigidbody2D
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaxkr committed Aug 29, 2024
1 parent 70abad1 commit 6f6c894
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions ingredients/Handling Transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class AsteroidMovement extends Behavior {
}

// Example of moving an entity based on another entities position. A more advanced example
import { Behavior, Rigidbody2D, Sprite2D } from "@dreamlab/engine";
import { Behavior, RectCollider2D, Sprite2D } from "@dreamlab/engine";
import BulletBehavior from "./bullet.ts";

export default class EnemyMovement extends Behavior {
Expand Down Expand Up @@ -83,15 +83,14 @@ export default class EnemyMovement extends Behavior {
const rotation = this.entity.transform.rotation + Math.PI / 2;

this.entity.game.world.spawn({
type: Rigidbody2D,
type: RectCollider2D,
name: "EnemyBullet",
transform: {
position: this.entity.transform.position.clone(),
rotation,
scale: { x: 0.25, y: 0.25 },
},
behaviors: [{ type: BulletBehavior, values: { speed: 8 } }],
values: { type: "fixed" },
children: [
{
type: Sprite2D,
Expand Down
4 changes: 2 additions & 2 deletions ingredients/Interacting with Behaviors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {
BehaviorContext,
Entity,
GamePostTick,
Rigidbody2D,
RectCollider2D,
Sprite2D,
Vector2,
} from '@dreamlab/engine'
Expand Down Expand Up @@ -105,7 +105,7 @@ export default class HealthBar extends Behavior {

for (let i = 0; i < pieceCount; i++) {
this.entity.game.world.spawn({
type: Rigidbody2D,
type: Sprite2D,
name: 'ExplosionPiece',
transform: {
position: this.entity.transform.position.clone(),
Expand Down

0 comments on commit 6f6c894

Please sign in to comment.