Skip to content

Commit

Permalink
client: Add basic purple slime implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVector committed Sep 10, 2024
1 parent 0d2c20d commit b054ba4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/actors/entities/entity-factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EntityType } from "./entity";
import { Player } from "./player/player";
import { Slime } from "./slime/slime";
import { SlimePurple } from "./slime/slime-purple";

export function createEntity(entityType: EntityType, id: string) {
switch (entityType) {
Expand All @@ -9,7 +10,7 @@ export function createEntity(entityType: EntityType, id: string) {
case EntityType.SLIME:
return new Slime(id);
case EntityType.SLIME_PURPLE:
return new Slime(id); // TODO: Implement purple slime
return new SlimePurple(id);
default:
throw new Error(`Entity type ${entityType} not found`);
}
Expand Down
12 changes: 12 additions & 0 deletions client/src/actors/entities/slime/slime-purple.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Color } from "excalibur";
import { Slime } from "./slime";

export class SlimePurple extends Slime {
public static override MAX_HP = 4;

constructor(netId: string) {
super(netId);
this.hp = SlimePurple.MAX_HP;
this.color = Color.Violet;
}
}

0 comments on commit b054ba4

Please sign in to comment.