Fixed the problem! Fov works now
This commit is contained in:
parent
8bbf6c4ff5
commit
eea1fa9388
5
fov.go
5
fov.go
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"steel/mapping"
|
"steel/mapping"
|
||||||
|
|
||||||
"github.com/kettek/goro/fov"
|
"github.com/kettek/goro/fov"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -18,6 +19,6 @@ func InitializeFoV(g *mapping.GameMap) fov.Map {
|
||||||
return fovMap
|
return fovMap
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecomputeFov(fovMap fov.Map, centerX, centerY int, radius int, fov.Light) {
|
func RecomputeFov(fovMap fov.Map, centerX, centerY int, radius int, fovLight fov.Light) {
|
||||||
fovMap.Recompute(centerX, centerY, radius, light)
|
fovMap.Recompute(centerX, centerY, radius, fovLight)
|
||||||
}
|
}
|
||||||
|
|
10
main.go
10
main.go
|
@ -1,13 +1,12 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/kettek/goro"
|
|
||||||
"github.com/kettek/goro-game/entity"
|
|
||||||
"github.com/kettek/goro-game/mapping"
|
|
||||||
"github.com/kettek/goro/fov"
|
|
||||||
"log"
|
"log"
|
||||||
"steel/entity"
|
"steel/entity"
|
||||||
"steel/mapping"
|
"steel/mapping"
|
||||||
|
|
||||||
|
"github.com/kettek/goro"
|
||||||
|
"github.com/kettek/goro/fov"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -60,7 +59,7 @@ func main() {
|
||||||
for {
|
for {
|
||||||
|
|
||||||
if fovRecompute {
|
if fovRecompute {
|
||||||
RecomputeFoV(fovMap, player.X, player.Y, fovRadius, fov.Light{})
|
RecomputeFov(fovMap, player.X, player.Y, fovRadius, fov.Light{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw screen.
|
// Draw screen.
|
||||||
|
@ -77,6 +76,7 @@ func main() {
|
||||||
case ActionMove:
|
case ActionMove:
|
||||||
if !gameMap.IsBlocked(player.X+action.X, player.Y+action.Y) {
|
if !gameMap.IsBlocked(player.X+action.X, player.Y+action.Y) {
|
||||||
player.Move(action.X, action.Y)
|
player.Move(action.X, action.Y)
|
||||||
|
fovRecompute = true
|
||||||
}
|
}
|
||||||
case ActionQuit:
|
case ActionQuit:
|
||||||
goro.Quit()
|
goro.Quit()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user