refactor level, getting to tiles
This commit is contained in:
@ -37,7 +37,7 @@ func (f *FieldOfVision) SetTorchRadius(radius int) {
|
||||
func (f *FieldOfVision) SetAllInvisible(level *gamemap.Level) {
|
||||
for x := 0; x < level.W; x++ {
|
||||
for y := 0; y < level.H; y++ {
|
||||
level.Tiles[x][y].Visible = false
|
||||
level.GetTileByXY(x,y).Visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -57,7 +57,7 @@ func (f *FieldOfVision) RayCast(playerCoords types.Coords, level *gamemap.Level)
|
||||
y := float64(playerCoords.Y)
|
||||
|
||||
// Mark the players current position as explored
|
||||
tile := level.Tiles[playerCoords.X][playerCoords.Y]
|
||||
tile := level.GetTile(playerCoords) //[playerCoords.X][playerCoords.Y]
|
||||
tile.Explored = true
|
||||
tile.Visible = true
|
||||
|
||||
@ -73,12 +73,12 @@ func (f *FieldOfVision) RayCast(playerCoords types.Coords, level *gamemap.Level)
|
||||
break
|
||||
}
|
||||
|
||||
tile := level.Tiles[roundedX][roundedY]
|
||||
tile := level.GetTileByXY(roundedX, roundedY)
|
||||
|
||||
tile.Explored = true
|
||||
tile.Visible = true
|
||||
|
||||
if level.Tiles[roundedX][roundedY].BlocksSight == true {
|
||||
if level.GetTileByXY(roundedX, roundedY).BlocksSight == true {
|
||||
// The ray hit a wall, go no further
|
||||
break
|
||||
}
|
||||
|
Reference in New Issue
Block a user