note blocks and sticky test
This commit is contained in:
parent
1bc1cdb11f
commit
d829b4972f
11 changed files with 3389 additions and 118 deletions
30
note.lua
Normal file
30
note.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
require "entity"
|
||||
|
||||
-- An editor annotation dropped onto the grid. A Note is a normal Entity (so it
|
||||
-- serializes, places and hit-tests like any other object) that carries a bit of
|
||||
-- author text. It is deliberately non-collidable — the player passes straight
|
||||
-- through it — and only ever renders as a translucent icon while the editor is
|
||||
-- available (DEBUG) and notes are toggled on (see NOTES_VISIBLE / Room:draw).
|
||||
Note = class("Note", Entity)
|
||||
|
||||
local noteSprite = loadSprite("art/_debug/notepad.png")
|
||||
|
||||
function Note:initialize(x, y, text)
|
||||
self.text = text or ""
|
||||
self.saveClass = "note"
|
||||
Entity.initialize(self, {
|
||||
x = x, y = y,
|
||||
color = "white", -- representative only; Note:draw ignores channels
|
||||
collision = "none",
|
||||
sprite = noteSprite,
|
||||
})
|
||||
end
|
||||
|
||||
-- Drawn once (not per-channel) as a faint overlay. Called directly from the
|
||||
-- room's note pass, so it takes no channel argument.
|
||||
function Note:draw()
|
||||
love.graphics.setColor(1, 1, 1, 0.85)
|
||||
local p = self:getDrawPos()
|
||||
love.graphics.draw(self.sprite, p.x, p.y, 0, drawScale, drawScale)
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue