Private
Public Access
1
0

big refactor
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 48s

This commit is contained in:
Sebastian Unterschütz
2025-11-25 18:11:47 +01:00
parent 6afcd4aa94
commit 732f507547
17 changed files with 1519 additions and 1295 deletions

48
config.go Normal file
View File

@@ -0,0 +1,48 @@
package main
import (
"context"
"log"
"os"
"github.com/redis/go-redis/v9"
)
const (
Gravity = 0.6
JumpPower = -12.0
GroundY = 350.0
PlayerHeight = 50.0
PlayerYBase = GroundY - PlayerHeight
GameSpeed = 5.0
GameWidth = 800.0
)
// Globale Variablen
var (
ctx = context.Background()
rdb *redis.Client
defaultConfig GameConfig
adminUser string
adminPass string
)
func getEnv(key, fallback string) string {
if value, ok := os.LookupEnv(key); ok {
return value
}
return fallback
}
func initGameConfig() {
defaultConfig = GameConfig{
Obstacles: []ObstacleDef{
{ID: "desk", Width: 40, Height: 30, Color: "#8B4513", Image: "desk.png"},
{ID: "teacher", Width: 30, Height: 60, Color: "#000080", Image: "teacher.png", CanTalk: true, SpeechLines: []string{"Halt!", "Handy weg!", "Nachsitzen!"}},
{ID: "trashcan", Width: 25, Height: 35, Color: "#555", Image: "trash.png"},
{ID: "eraser", Width: 30, Height: 20, Color: "#fff", Image: "eraser.png", YOffset: 45.0},
},
Backgrounds: []string{"background.jpg"},
}
log.Println("✅ Config geladen")
}