28 lines
No EOL
573 B
Lua
28 lines
No EOL
573 B
Lua
require "entity"
|
|
|
|
Switch = class("Switch", Entity)
|
|
|
|
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 = loadSprite("art/game/switch_" .. color:sub(1, 1) .. ".png")
|
|
})
|
|
|
|
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 |