Private
Public Access
1
0

add offline moving platform logic: implement dynamic platform detection and movement handling in offline mode
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m49s

This commit is contained in:
Sebastian Unterschütz
2026-04-22 23:52:32 +02:00
parent 0e15b3fe53
commit f1dff8d64c
4 changed files with 77 additions and 11 deletions

View File

@@ -77,6 +77,10 @@ func (w *World) GenerateColliders(activeChunks []ActiveChunk) []Collider {
}
for _, obj := range chunk.Objects {
if obj.MovingPlatform != nil {
continue // Überspringe bewegende Plattformen, werden dynamisch geprüft
}
def, ok := w.Manifest.Assets[obj.AssetID]
if !ok {
fmt.Printf("⚠️ Asset '%s' nicht in Manifest!\n", obj.AssetID)

View File

@@ -218,6 +218,10 @@ func (c *ClientCollisionChecker) CheckCollision(x, y, w, h float64) (bool, strin
for _, activeChunk := range c.ActiveChunks {
if chunk, ok := c.World.ChunkLibrary[activeChunk.ChunkID]; ok {
for _, obj := range chunk.Objects {
if obj.MovingPlatform != nil {
continue // Wird separat als MovingPlatform geprüft
}
if assetDef, ok := c.World.Manifest.Assets[obj.AssetID]; ok {
if assetDef.Hitbox.W > 0 && assetDef.Hitbox.H > 0 {
colliderRect := game.Rect{
@@ -228,7 +232,11 @@ func (c *ClientCollisionChecker) CheckCollision(x, y, w, h float64) (bool, strin
}
if game.CheckRectCollision(playerRect, colliderRect) {
return true, assetDef.Hitbox.Type
colType := assetDef.Hitbox.Type
if colType == "" {
colType = assetDef.Type
}
return true, colType
}
}
}