2024-08-26 10:02:05 -06:00
|
|
|
package pong
|
|
|
|
|
|
|
|
type GameState struct {
|
2024-09-26 19:49:59 -06:00
|
|
|
Message string
|
|
|
|
Winner string
|
2024-08-26 10:02:05 -06:00
|
|
|
Score map[string]int
|
|
|
|
Player1 Player
|
|
|
|
Player2 Player
|
|
|
|
Ball Ball
|
|
|
|
}
|
|
|
|
|
|
|
|
type Vector struct {
|
|
|
|
X float32
|
|
|
|
Y float32
|
|
|
|
}
|
|
|
|
|
|
|
|
type Player struct {
|
|
|
|
client GameClient
|
|
|
|
Pos Vector
|
|
|
|
Size Vector
|
|
|
|
}
|
|
|
|
|
|
|
|
type Ball struct {
|
|
|
|
Pos Vector
|
|
|
|
Vel Vector
|
|
|
|
}
|
2024-09-26 19:49:59 -06:00
|
|
|
|
|
|
|
type StateUpdate struct {
|
|
|
|
// The field to update on the state object dot separated
|
|
|
|
// I.e Player1.Speed = the speed field on Player1
|
|
|
|
FieldPath string
|
|
|
|
Value []byte
|
|
|
|
}
|