Some starting stuff...
Code: Select all
tile = {
}
map = {
}
function tile.new(x, y, id, w, h)
local self = {}
self.x, self.y = x, y
self.w, self.h = w or 32, h or 32
self.id = id
self.moused = false
self.stoodUpon = false
return setmetatable(self, tile)
end
Code: Select all
function mapStartClick(x, y, button)
for k, v in ipairs(map) do
if button == "l" and v.moused then
if v.id == 1 then
v.id = 2
else
v.id = 1
end
end
end
end
vvv this one did not
Code: Select all
function map:startClick(x, y, button)
if button == "l" and self.moused then
if self.id == 1 then
self.id = 2
else
self.id = 1
end
end
end
just to clearify, the "startClick" portion is like the function name, and the thing on the left side of the colon is the name of the table that I'm trying to access. Is it because I'm trying to access a value in the table "map" when they're all tables? I can't think of any other reason.