30 lines
848 B
Go
30 lines
848 B
Go
package protocol
|
|
|
|
// Input: Was der Spieler drückt
|
|
type InputMessage struct {
|
|
PlayerID string `json:"id"`
|
|
Jump bool `json:"jump"`
|
|
}
|
|
|
|
// State: Wo alles ist (Server -> Client)
|
|
type GameStateMessage struct {
|
|
Players map[string]*PlayerState `json:"players"` // Alle Spieler (1 bis 16)
|
|
Score float64 `json:"score"`
|
|
Multiplier int `json:"multiplier"`
|
|
MovingPlatforms []*MovingPlatformState `json:"moving_platforms"` // Bewegende Plattformen
|
|
}
|
|
|
|
type PlayerState struct {
|
|
// WICHTIG: Jedes Feld braucht ein eigenes JSON-Tag!
|
|
X float64 `json:"x"`
|
|
Y float64 `json:"y"`
|
|
}
|
|
|
|
type MovingPlatformState struct {
|
|
ChunkID string `json:"chunk_id"`
|
|
ObjectIdx int `json:"object_idx"`
|
|
AssetID string `json:"asset_id"`
|
|
X float64 `json:"x"`
|
|
Y float64 `json:"y"`
|
|
}
|