jasonlooked #1

Merged
eros merged 21 commits from jasonlooked into main 2026-07-11 10:13:09 -07:00
2 changed files with 11 additions and 4 deletions
Showing only changes of commit ef5349dfe3 - Show all commits

View File

@ -26,6 +26,13 @@ export interface StoneState {
active: boolean
}
export interface DrawableStone {
x: number
y: number
rotation: number
team: Team
}
export interface ClientThrowMessage {
type: 'throw'
broom_x: number
Review

stone trajectory data structucture should be called trajectories with shape something like {stones: [{stoneid, rotation, team, trajectory:[x,y,theta]}])

same on the backend

stone trajectory data structucture should be called trajectories with shape something like {stones: [{stoneid, rotation, team, trajectory:[x,y,theta]}]) same on the backend

View File

@ -9,8 +9,8 @@ import {
STONE_RADIUS,
TWELVE_FT_RADIUS,
HOUSE_CENTER,
type DrawableStone,
type StoneState,
type Team,
} from './protocol'
export interface Renderer {
@ -23,7 +23,7 @@ export interface Renderer {
stones: StoneState[]
broom: { x: number; y: number } | null
animating: boolean
activeStonePos: { x: number; y: number; rotation: number; team: Team } | null
activeStonePos: DrawableStone | null
}) => void
}
@ -102,7 +102,7 @@ export function createRenderer(canvas: HTMLCanvasElement): Renderer {
}
}
const drawStone = (stone: StoneState | { x: number; y: number; rotation: number; team: Team }) => {
const drawStone = (stone: DrawableStone) => {
const c = worldToScreen(stone.x, stone.y)
const r = STONE_RADIUS * scale()
const color = stone.team === 'red' ? '#d93025' : '#f9ab00'
@ -129,7 +129,7 @@ export function createRenderer(canvas: HTMLCanvasElement): Renderer {
stones: StoneState[]
broom: { x: number; y: number } | null
animating: boolean
activeStonePos: { x: number; y: number; rotation: number; team: Team } | null
activeStonePos: DrawableStone | null
}) => {
ctx.clearRect(0, 0, window.innerWidth, window.innerHeight)
Review

draw stones animations all at the same time. not one animation after another.

draw stones animations all at the same time. not one animation after another.
Review

active stones don't need to be distinct from inactive stones. they can be all be active unless they go out of bounds

active stones don't need to be distinct from inactive stones. they can be all be active unless they go out of bounds