switched to yadu debug log
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package systems
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"openquell/assets"
|
||||
"openquell/components"
|
||||
. "openquell/components"
|
||||
@@ -54,7 +54,7 @@ func (system *CollectibleSystem) Update() {
|
||||
|
||||
ok, _ := playerposition.Intersects(colposition, playervelocity)
|
||||
if ok {
|
||||
fmt.Printf("bumped into collectible %v\n", collectible)
|
||||
slog.Debug("bumped into collectible", "collectible", collectible)
|
||||
particlepositions = append(particlepositions, colposition)
|
||||
EntitiesToRemove = append(EntitiesToRemove, query.Entity())
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package systems
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image"
|
||||
"image/draw"
|
||||
"openquell/components"
|
||||
@@ -141,16 +140,12 @@ func (system *GridSystem) BumpEdge(
|
||||
switch velocity.Direction {
|
||||
case East:
|
||||
X = 0
|
||||
fmt.Println("east X=0")
|
||||
case West:
|
||||
X = system.Width - system.Tilesize
|
||||
fmt.Println("west X=max")
|
||||
case South:
|
||||
Y = 0
|
||||
fmt.Println("south y=0")
|
||||
case North:
|
||||
Y = system.Height - system.Tilesize
|
||||
fmt.Println("north y=max")
|
||||
}
|
||||
|
||||
newpos.Update(X, Y, system.Tilesize)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package systems
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
. "openquell/components"
|
||||
. "openquell/config"
|
||||
|
||||
@@ -53,19 +53,17 @@ func (system PlayerSystem) Update() error {
|
||||
if velocity.Moving() {
|
||||
ok, newpos := system.Grid.BumpEdge(playerposition, velocity)
|
||||
if ok {
|
||||
fmt.Printf("falling off the edge, new pos: %v\n", newpos)
|
||||
slog.Debug("falling off the edge", "newpos", newpos)
|
||||
playerposition.Set(newpos)
|
||||
} else {
|
||||
ok, tilepos := system.Grid.GetSolidNeighborPosition(playerposition, velocity, true)
|
||||
if ok {
|
||||
intersects, newpos := tilepos.Intersects(playerposition, velocity)
|
||||
if intersects {
|
||||
fmt.Printf("collision detected. tile: %s\n", tilepos)
|
||||
fmt.Printf(" player: %s\n", playerposition)
|
||||
fmt.Printf(" new: %s\n", newpos)
|
||||
slog.Debug("collision detected", "tile",
|
||||
tilepos, "player", playerposition, "new", newpos)
|
||||
|
||||
playerposition.Set(newpos)
|
||||
fmt.Printf(" player new: %s\n", playerposition)
|
||||
velocity.Change(Stop)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user