get info pad rendering
This commit is contained in:
parent
45bfeb5eb5
commit
414006b667
3 changed files with 42 additions and 17 deletions
31
two_player_cleaning_game/src/entities/info-pad.fnl
Normal file
31
two_player_cleaning_game/src/entities/info-pad.fnl
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
(local utils (require "src/utils.fnl"))
|
||||
(local beholder (require "libs/beholder"))
|
||||
(local color (require "src/colors.fnl"))
|
||||
(local levels (require "levels.fnl"))
|
||||
(local assets (require "src/assets.fnl"))
|
||||
|
||||
(lambda info-pad [x y name]
|
||||
(let [pad {: x : y : name}
|
||||
(w h) (assets.objects-sprite:getDimensions)]
|
||||
(lambda pad.load [self]
|
||||
(set self.quad (love.graphics.newQuad 75 0 25 25 w h)))
|
||||
|
||||
(fn pad.draw-debug [self]
|
||||
(color.set-color :black)
|
||||
(love.graphics.rectangle "line" self.x self.y 25 25))
|
||||
|
||||
(lambda pad.draw49 [self]
|
||||
(color.reset-color)
|
||||
(love.graphics.draw assets.objects-sprite self.quad self.x self.y))
|
||||
pad
|
||||
|
||||
|
||||
))
|
||||
|
||||
|
||||
info-pad
|
||||
|
||||
; (lambda [{:bump-world bw :level-key key}]
|
||||
; (set bump-world bw)
|
||||
; (set level-key key)
|
||||
; player)
|
||||
|
|
@ -7,21 +7,17 @@
|
|||
(local player (require "src/entities/player.fnl"))
|
||||
(local walls (require "src/systems/walls.fnl"))
|
||||
(local hud (require "src/systems/hud.fnl"))
|
||||
(local levels (require "levels.fnl"))
|
||||
(local info-pad (require "src/entities/info-pad.fnl"))
|
||||
|
||||
(lambda load-objects [level-key pool]
|
||||
(each [_ object (pairs (. levels :levels level-key :objects))]
|
||||
; (debug-print object)
|
||||
(case object.type
|
||||
"info_pad" (pool:queue (info-pad object.x object.y object.name))
|
||||
))
|
||||
)
|
||||
|
||||
; (local colliders {
|
||||
; :added {}
|
||||
; })
|
||||
; (fn colliders.update [self]
|
||||
; (each [_ c (ipairs self.pool.groups.colliders.entities)]
|
||||
; (when (not (. self.added (. c 1)))
|
||||
; (print "Adding collider to list")
|
||||
; (utils.debug-print c)
|
||||
; (tset self.added (. c 1) true)
|
||||
; )))
|
||||
; (let [obj (. c 1)]
|
||||
; (when (not (. self.added obj))
|
||||
; (set self.added obj true)
|
||||
; (self.pool.data.bump-world:add (unpack c))))))
|
||||
|
||||
(fn load [screen]
|
||||
(let [
|
||||
|
|
@ -47,6 +43,7 @@
|
|||
]
|
||||
})]
|
||||
(pool:queue (player {:bump-world bump-world :level-key :tutorial}))
|
||||
(load-objects :tutorial pool)
|
||||
pool))
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue