Skip to content

Commit

Permalink
fix: enable ai
Browse files Browse the repository at this point in the history
  • Loading branch information
LiprikON2 committed Jul 27, 2024
1 parent a9d6a31 commit 9ea06f6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 25 deletions.
11 changes: 9 additions & 2 deletions client/src/game/scripts/objects/Sprite/Spaceship/Mob/Mob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Mob extends Spaceship {
isReadyToFire = false;
isSleeping = false;
isAggresive = true;
disableAI = true;
disableAi = false;

readyToFireEvent: Phaser.Time.TimerEvent | null;
sleepEvent: Phaser.Time.TimerEvent | null;
Expand Down Expand Up @@ -68,7 +68,14 @@ export class Mob extends Spaceship {

update(time, delta) {
super.update(time, delta);
if (this.disableAI) return;
const { x, y } = this.getActionsState();

const s = Phaser.Math.Between(0, 200);
// if (s === 444) this.teleport(x + 50, y + 50);
if (s === 111) this.staticBox.setPosition(x + 50, y + 50);
console.log("x,y", x, y);

if (this.disableAi) return;
this.sleep(this.reactionTime);
this.exhausts.updateExhaustPosition();

Expand Down
8 changes: 6 additions & 2 deletions client/src/game/scripts/objects/Sprite/Spaceship/Spaceship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ export class Spaceship extends Sprite {
this.scene.physics.world.enable(this.staticBox);
// this.staticBox.body.setCollideWorldBounds(true);

this.rotatingBox.pin(this);
this.rotatingBox.pin(this, { syncPosition: false });

this.shields = new Shields(this);
this.staticBox.pin(this.shields, { syncRotation: false });
this.staticBox.pin(this.rotatingBox, { syncRotation: false });
this.staticBox.pin(this.rotatingBox, { syncPosition: false, syncRotation: false });

// Modules
const { modules } = this.atlasMetadata;
Expand Down Expand Up @@ -264,6 +264,10 @@ export class Spaceship extends Sprite {
this.rotatingBox.setDepth(this.depth + 100);

this.pilot = new Pilot();

for (let i = 0; i < 100; i++) {
this.setPosition(x, y);
}
}
/**
* Destroys not only the sprite itself, but also related objects pinned to its bounding box
Expand Down
50 changes: 29 additions & 21 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ea06f6

Please sign in to comment.