get info pad rendering

This commit is contained in:
Travis Shears 2026-04-24 23:24:26 +02:00
parent 45bfeb5eb5
commit 414006b667
Signed by: travisshears
GPG key ID: CB9BF1910F3F7469
3 changed files with 42 additions and 17 deletions

View file

@ -76,7 +76,4 @@
<object id="15" name="controls" type="info_pad" x="550" y="1150" width="25" height="25"/> <object id="15" name="controls" type="info_pad" x="550" y="1150" width="25" height="25"/>
<object id="16" name="controls" type="info_pad" x="675" y="1150" width="25" height="25"/> <object id="16" name="controls" type="info_pad" x="675" y="1150" width="25" height="25"/>
</objectgroup> </objectgroup>
<objectgroup id="4" name="Layer via Copy">
<object id="18" name="waiting_for_player2" type="info_pad" x="675" y="1025" width="25" height="25"/>
</objectgroup>
</map> </map>

View 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)

View file

@ -7,21 +7,17 @@
(local player (require "src/entities/player.fnl")) (local player (require "src/entities/player.fnl"))
(local walls (require "src/systems/walls.fnl")) (local walls (require "src/systems/walls.fnl"))
(local hud (require "src/systems/hud.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] (fn load [screen]
(let [ (let [
@ -47,6 +43,7 @@
] ]
})] })]
(pool:queue (player {:bump-world bump-world :level-key :tutorial})) (pool:queue (player {:bump-world bump-world :level-key :tutorial}))
(load-objects :tutorial pool)
pool)) pool))
{ {