add spinning radar system
This commit is contained in:
parent
6c895c8842
commit
31fb931c4a
2 changed files with 38 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
(local hud (require "src/systems/hud.fnl"))
|
(local hud (require "src/systems/hud.fnl"))
|
||||||
(local levels (require "levels.fnl"))
|
(local levels (require "levels.fnl"))
|
||||||
(local fog-of-war (require "src/systems/fog_of_war.fnl"))
|
(local fog-of-war (require "src/systems/fog_of_war.fnl"))
|
||||||
|
(local radar (require "src/systems/radar.fnl"))
|
||||||
(local info-pad (require "src/entities/info-pad.fnl"))
|
(local info-pad (require "src/entities/info-pad.fnl"))
|
||||||
|
|
||||||
; TODO: refactor the args away. create a load method and get them from self.pool
|
; TODO: refactor the args away. create a load method and get them from self.pool
|
||||||
|
|
@ -60,6 +61,7 @@
|
||||||
camera
|
camera
|
||||||
walls
|
walls
|
||||||
fog-of-war
|
fog-of-war
|
||||||
|
radar
|
||||||
(hud {: screen})
|
(hud {: screen})
|
||||||
]
|
]
|
||||||
})]
|
})]
|
||||||
|
|
|
||||||
36
game/src/systems/radar.fnl
Normal file
36
game/src/systems/radar.fnl
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
(local color (require "src/colors.fnl"))
|
||||||
|
(local utils (require "src/utils.fnl"))
|
||||||
|
(local beholder (require "libs/beholder"))
|
||||||
|
(local levels (require "levels.fnl"))
|
||||||
|
(local assets (require "src/assets.fnl"))
|
||||||
|
|
||||||
|
(local radar
|
||||||
|
{ :player-pos [0 0]
|
||||||
|
:rot 0
|
||||||
|
:speed 4 })
|
||||||
|
|
||||||
|
(lambda radar.load [self]
|
||||||
|
(beholder.observe "PLAYER.POS" (lambda [x y]
|
||||||
|
(set self.player-pos [x y]))))
|
||||||
|
|
||||||
|
(lambda radar.update [self dt]
|
||||||
|
(set self.rot (+ self.rot (* (/ dt self.speed)))))
|
||||||
|
|
||||||
|
(lambda radar.draw81 [self]
|
||||||
|
(let [
|
||||||
|
w 19 h 15
|
||||||
|
[x y] self.player-pos
|
||||||
|
ox (+ x (/ w 2))
|
||||||
|
oy (+ y (/ h 2))
|
||||||
|
]
|
||||||
|
(color.set-color :dark-pink)
|
||||||
|
(love.graphics.push)
|
||||||
|
(love.graphics.translate ox oy)
|
||||||
|
(love.graphics.rotate self.rot)
|
||||||
|
(love.graphics.setPointSize 2)
|
||||||
|
(love.graphics.points 0 0)
|
||||||
|
(love.graphics.circle "line" 0 0 150)
|
||||||
|
(love.graphics.line 0 0 0 150)
|
||||||
|
(love.graphics.pop)))
|
||||||
|
|
||||||
|
radar
|
||||||
Loading…
Add table
Add a link
Reference in a new issue