-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.go
29 lines (24 loc) · 864 Bytes
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"github.com/gogue-framework/gogue/ecs"
"github.com/gogue-framework/gogue/gamemap"
)
// GetBlockingEntities returns true if there is an entity at the location, and that entity has the Blocking component
func GetBlockingEntities(x, y int, entityController *ecs.Controller) bool {
for _, entity := range entityController.GetEntitiesWithComponent(BlockingComponent{}.TypeOf()) {
entityPosition := entityController.GetComponent(entity, PositionComponent{}.TypeOf()).(PositionComponent)
if entityPosition.X == x && entityPosition.Y == y {
return true
}
}
return false
}
// Debug Utils
// MakeAllVisible makes all map Tiles visible to the player
func MakeAllVisible(mapSurface *gamemap.GameMap) {
for x := 0; x < mapSurface.Width; x++ {
for y := 0; y < mapSurface.Height; y++ {
mapSurface.Tiles[x][y].Visible = true
}
}
}