Skip to content

Commit

Permalink
use thread
Browse files Browse the repository at this point in the history
  • Loading branch information
RSamaium committed Apr 10, 2024
1 parent bef3c02 commit f943c80
Show file tree
Hide file tree
Showing 12 changed files with 14,417 additions and 361 deletions.
8 changes: 7 additions & 1 deletion packages/client/src/GameEngine.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { GameSide, RpgCommonGame } from "@rpgjs/common";
import { signal } from "canvasengine";

export class GameEngineClient {
export class GameEngineClient extends RpgCommonGame {
playerId = signal("");
session = signal("");
objects = signal<any[]>([]);

animationX: any;
animationY: any;

async initialize() {
super.initialize(GameSide.Client, Worker);
}

updateObject(obj) {
const { playerId: id, params, localEvent, paramsChanged, isShape } = obj;
const findObject = this.objects().find((o: any) => o.id == id);
Expand All @@ -21,6 +26,7 @@ export class GameEngineClient {
direction: signal(params.direction),
})
);
this.addObject(params)
} else {
if (paramsChanged.position?.x) {
if (this.animationX) {
Expand Down
Loading

0 comments on commit f943c80

Please sign in to comment.