diff options
Diffstat (limited to 'test-client')
-rw-r--r-- | test-client/main.ts | 3 | ||||
-rw-r--r-- | test-client/protocol.ts | 4 | ||||
-rw-r--r-- | test-client/visual.ts | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/test-client/main.ts b/test-client/main.ts index 0cd5c4cb..c4db6935 100644 --- a/test-client/main.ts +++ b/test-client/main.ts @@ -159,6 +159,7 @@ function packet(p: PacketC) { if (p.player == my_id) return pl.position.x = pos.x pl.position.y = pos.y + pl.boosting = p.boosting pl.rot = p.rot break; } @@ -289,7 +290,7 @@ function set_interact(edge: boolean) { function tick_update() { const p = players.get(my_id) if (!p) return - send({ type: "position", pos: [p.position.x, p.position.y], rot: p.rot }) + send({ type: "position", pos: [p.position.x, p.position.y], rot: p.rot, boosting: p.boosting }) } function frame_update(dt: number) { diff --git a/test-client/protocol.ts b/test-client/protocol.ts index fd0f8d43..f3bb8acb 100644 --- a/test-client/protocol.ts +++ b/test-client/protocol.ts @@ -30,7 +30,7 @@ export interface Gamedata { export type PacketS = { type: "join", name: string, character: number } // You join, sent as first packet. - | { type: "position", pos: Vec2, rot: number } // Update your position and rotation in radians (0 is -y) + | { type: "position", pos: Vec2, rot: number, boosting: boolean } // Update your position and rotation in radians (0 is -y) | { type: "interact", pos: Vec2, edge: boolean } // Interact with some tile. edge is true when pressing and false when releasing interact button | { type: "communicate", message?: Message, persist: boolean } // Send a message | { type: "collide", player: PlayerID, force: Vec2 } // Apply force to another player as a result of a collision @@ -40,7 +40,7 @@ export type PacketC = | { type: "data", data: Gamedata } // Game data was changed | { type: "add_player", id: PlayerID, name: string, position: Vec2, character: number } // Somebody else joined (or was already in the game) | { type: "remove_player", id: PlayerID } // Somebody left - | { type: "position", player: PlayerID, pos: Vec2, rot: number } // Update the position of a players (your own position is included here) + | { type: "position", player: PlayerID, pos: Vec2, rot: number, boosting: boolean } // Update the position of a players (your own position is included here) | { type: "move_item", from: ItemLocation, to: ItemLocation } // Item moved | { type: "set_item", location: ItemLocation, item?: ItemIndex } // the item contained in a tile or player changed | { type: "set_progress", item: ItemLocation, progress?: number, warn: boolean } // A tile is doing something. progress goes from 0 to 1, then null when finished diff --git a/test-client/visual.ts b/test-client/visual.ts index 2fbe9f78..5d9b7a76 100644 --- a/test-client/visual.ts +++ b/test-client/visual.ts @@ -132,6 +132,7 @@ function draw_player(player: PlayerData) { ctx.save() ctx.translate(player.anim_position.x, player.anim_position.y) ctx.rotate(-player.rot) + if (player.boosting) ctx.scale(1.3, 1.3) draw_character(player.character) ctx.restore() |