diagnostic tool fixes

This commit is contained in:
2024-04-22 13:52:17 +03:00
parent 4f18b6db18
commit dc2e6ea2b5
20 changed files with 178 additions and 160 deletions

View File

@ -23,11 +23,11 @@ func (mov Moveable) Walk() {
//fixme change it to WhatsOnTile
func (mov Moveable) IsBlocked(c types.Coords) bool {
if mov.Level.GetTile(c).BlocksPass == true {
if mov.Level.GetTile(c).BlocksPass {
return true
}
list := mov.Controller.GetEntitiesWithComponent(ecs.MobComponent)
for idx, _ := range list {
for idx := range list {
coords := mov.Controller.GetComponent(list[idx], ecs.CoordsComponent)
if coords == nil {
continue
@ -50,7 +50,7 @@ func (mov Moveable) IsBlocked(c types.Coords) bool {
func Walk(entity ecs.Entity, state *gamestate.GameState, dx, dy int) {
controller := state.Controller
coords := controller.GetComponent(state.Player, ecs.CoordsComponent).(types.Coords)
newCoords := types.Coords{coords.X + dx, coords.Y + dy}
newCoords := types.Coords{X: coords.X + dx, Y: coords.Y + dy}
if !state.Level.InBounds(newCoords) {
return
}