Private
Public Access
1
0

Introduce core components for "Escape From Teacher" game: server, client, physics, asset system, and protocol definitions. Add Docker-Compose setup for Redis and NATS infrastructure.

This commit is contained in:
Sebastian Unterschütz
2026-01-01 15:21:18 +01:00
commit 3099ac42c0
9 changed files with 1384 additions and 0 deletions

25
pkg/physics/engine.go Normal file
View File

@@ -0,0 +1,25 @@
package physics
// Entity repräsentiert alles, was sich bewegt (Spieler, Hindernis)
type Entity struct {
X, Y float64
Width, Height float64
VelocityY float64
}
// Config für Konstanten (Schwerkraft etc.)
type Config struct {
Gravity float64
Speed float64
}
// Update simuliert einen Tick (z.B. 1/60 sekunde)
func (e *Entity) Update(cfg Config) {
e.VelocityY += cfg.Gravity
e.Y += e.VelocityY
// Einfache Boden-Kollision (Hardcoded für den Anfang)
if e.Y > 300 {
e.Y = 300
e.VelocityY = 0
}
}