chroma_solstice/switch.lua

34 lines
748 B
Lua
Raw Normal View History

2015-03-15 05:26:47 -04:00
require "entity"
Switch = class("Switch", Entity)
2015-03-15 13:54:47 -04:00
Switch.static.sprites = {
red = love.graphics.newImage("art/switch_r.png"),
green = love.graphics.newImage("art/switch_g.png"),
blue = love.graphics.newImage("art/switch_b.png"),
pressed = love.graphics.newImage("art/switch_pressed.png")
}
2015-03-15 05:26:47 -04:00
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!!
sprite = sprites.switch[color]
2015-03-15 05:26:47 -04:00
})
self.activated = false
end
function Switch:activate()
2015-03-15 13:54:47 -04:00
if self.activated == false then
self.activated = true
end
end
function Switch:deactivate()
if self.activated == true then
self.activated = false
end
2015-03-15 05:26:47 -04:00
end