- Afegits els "switches" i el concepte de "flags"
This commit is contained in:
18
data/switches.lua
Normal file
18
data/switches.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
switches={
|
||||
list={},
|
||||
|
||||
add=function(switch)
|
||||
if not switch.w then switch.w=1 end
|
||||
if not switch.h then switch.h=1 end
|
||||
table.insert(switches.list, switch)
|
||||
end,
|
||||
|
||||
search=function(x,y)
|
||||
for i,v in ipairs(switches.list) do
|
||||
if x>=v.x and x<v.x+v.w and y>=v.y and y<v.y+v.h then
|
||||
return v
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end,
|
||||
}
|
||||
Reference in New Issue
Block a user