reflection goes out of the window

This commit is contained in:
2019-11-10 01:24:45 +03:00
parent bc00262ead
commit f442dc6921
16 changed files with 87 additions and 63 deletions

View File

@ -83,12 +83,12 @@ func (ts *GameScreen) Render() {
func (ts *GameScreen) walk(state *gamestate.GameState, dx, dy int) {
controller := state.Controller
coords := controller.GetComponent(state.Player, types.Coords{}.TypeOf()).(types.Coords)
coords := controller.GetComponent(state.Player, ecs.CoordsComponent).(types.Coords)
newCoords := types.Coords{coords.X + dx, coords.Y + dy}
movable := controller.GetComponent(state.Player, movement.Moveable{}.TypeOf()).(movement.Moveable)
movable := controller.GetComponent(state.Player, ecs.MoveableComponent).(movement.Moveable)
if !movable.IsBlocked(newCoords) {
controller.UpdateComponent(state.Player, types.Coords{}.TypeOf(), newCoords)
controller.UpdateComponent(state.Player, ecs.CoordsComponent, newCoords)
}
state.Redraw <- struct{}{}