fixes:
- fixed bumpedge test for obstacles - fixed obstacle crash when going to the south or east - added wasm builder
This commit is contained in:
@@ -91,24 +91,30 @@ func (system *ObstacleSystem) Update() error {
|
||||
}
|
||||
}
|
||||
|
||||
//system.GridContainer.Grid.CheckGridCollision(obsposition, obsvelocity)
|
||||
// FIXME: this is the same loop as in player_system, unite the
|
||||
// two, just iterate over all entities with pos,vel,render, dammit
|
||||
if obsvelocity.Moving() {
|
||||
ok, tilepos := system.GridContainer.Grid.GetSolidNeighborPosition(obsposition, obsvelocity, true)
|
||||
ok, newpos := system.GridContainer.Grid.BumpEdge(obsposition, obsvelocity)
|
||||
if ok {
|
||||
intersects, newpos := tilepos.Intersects(obsposition, obsvelocity)
|
||||
if intersects {
|
||||
// slog.Debug("collision with foreign obstacle detected", "tile",
|
||||
// tilepos, "obs", obsposition, "new", newpos)
|
||||
//slog.Debug("falling off the edge", "newpos", newpos)
|
||||
obsposition.Set(newpos)
|
||||
} else {
|
||||
ok, tilepos := system.GridContainer.Grid.GetSolidNeighborPosition(obsposition, obsvelocity, true)
|
||||
if ok {
|
||||
intersects, newpos := tilepos.Intersects(obsposition, obsvelocity)
|
||||
if intersects {
|
||||
// slog.Debug("collision with foreign obstacle detected", "tile",
|
||||
// tilepos, "obs", obsposition, "new", newpos)
|
||||
|
||||
obsposition.Set(newpos)
|
||||
obsvelocity.ResetDirectionAndStop()
|
||||
obsposition.Set(newpos)
|
||||
obsvelocity.ResetDirectionAndStop()
|
||||
}
|
||||
}
|
||||
|
||||
obsposition.Move(obsvelocity)
|
||||
}
|
||||
|
||||
obsposition.Move(obsvelocity)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for _, entity := range EntitiesToRemove {
|
||||
|
||||
Reference in New Issue
Block a user