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:
25
pkg/physics/engine.go
Normal file
25
pkg/physics/engine.go
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user