chroma_solstice/switch.lua
2026-08-06 23:15:48 -04:00

35 lines
No EOL
800 B
Lua

require "entity"
Switch = class("Switch", Entity)
Switch.static.sprites = {
red = love.graphics.newImage("art/game/switch_r.png"),
green = love.graphics.newImage("art/game/switch_g.png"),
blue = love.graphics.newImage("art/game/switch_b.png"),
pressed = love.graphics.newImage("art/game/switch_pressed.png")
}
function Switch:initialize(x, y, color)
Entity.initialize(self, {
x = x,
y = y,
color = color,
collision = "none", --switches are floor elements that can't be pushed or bloc movement!!
cellShape = {{x = 1, y = 1}},
sprite = sprites.switch[color]
})
self.activated = false
end
function Switch:activate()
if self.activated == false then
self.activated = true
end
end
function Switch:deactivate()
if self.activated == true then
self.activated = false
end
end