Fortunately it seems I haven't repeated the mistake as much as I thought, anyone want to see if this works?
Code: Select all
pixelsy = {3.5,3.5,3.5,3.5,3.5,3,3,3,3,3,2.5,2.5,2.5,2.5,2.5,2,2,2,2,2,1.5,1.5,1.5,1.5,1.5}
if self.facing == 0 then
pixelsx = {-1,-0.5,0,0.5,1,-1,-0.5,0,0.5,1,-1,-0.5,0,0.5,1,-1,-0.5,0,0.5,1,-1,-0.5,0,0.5,1}
pixelsz ={1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3}
elseif self.facing == 1 then
pixelsz = {1,0.5,0,-0.5,-1,1,0.5,0,-0.5,-1,1,0.5,0,-0.5,-1,1,0.5,0,-0.5,-1,1,0.5,0,-0.5,-1}
pixelsx ={1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3,1.3}
elseif self.facing == 2 then
pixelsx = {1,0.5,0,-0.5,-1,1,0.5,0,-0.5,-1,1,0.5,0,-0.5,-1,1,0.5,0,-0.5,-1,1,0.5,0,-0.5,-1}
pixelsz ={-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3}
else
pixelsz = {-1,-0.5,0,0.5,1,-1,-0.5,0,0.5,1,-1,-0.5,0,0.5,1,-1,-0.5,0,0.5,1,-1,-0.5,0,0.5,1}
pixelsx ={-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3,-1.3}
end
n0 = {1,2,3,4,5,6,10,11,15,16,20,21,22,23,24,25}
n1 = {1,2,3,8,13,18,21,22,23,24,25}
n2 = {1,2,3,4,5,10,11,12,13,14,15,16,21,22,23,24,25}
n3 = {1,2,3,4,5,10,11,12,13,14,15,20,21,22,23,24,25}
n4 = {1,5,6,10,11,12,13,14,15,20,25}
n5 = {1,2,3,4,5,6,11,12,13,14,15,20,21,22,23,24,25}
n6 = {1,2,3,4,5,6,11,12,13,14,15,16,20,21,22,23,24,25}
n7 = {1,2,3,4,5,6,10,15,20,25}
n8 = {1,2,3,4,5,6,10,11,12,13,14,15,16,20,21,22,23,24,25}
n9 = {1,2,3,4,5,6,10,11,12,13,14,15,20,21,22,23,24,25}
function makelight()
for i=1,25 do
local check = findEntity(self.id..i)
if check == null then
spawn("fx", self.level, self.x, self.y, 3, self.id..i)
local lcd = findEntity(self.id..i)
lcd:setLight(1,0,0,500,0.3, 360000, false)
lcd:translate(0,-1,0)
end
end
end
function removelight()
for i=1,25 do
local check = findEntity(self.id..i)
if check ~= null then
local lcd = findEntity(self.id..i)
lcd:destroy()
end
end
end
function numlist(n)
if n == 0 then
for i=1,25 do
local pix = n0[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
if n == 1 then
for i=1,25 do
local pix = n1[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
if n == 2 then
for i=1,25 do
local pix = n2[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
if n == 3 then
for i=1,25 do
local pix = n3[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
if n == 4 then
for i=1,25 do
local pix = n4[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
if n == 5 then
for i=1,25 do
local pix = n5[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
if n == 6 then
for i=1,25 do
local pix = n6[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
if n == 7 then
for i=1,25 do
local pix = n7[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
if n == 8 then
for i=1,25 do
local pix = n8[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
if n == 9 then
for i=1,25 do
local pix = n9[i]
if pix ~= nil then
local lcd = findEntity(self.id..i)
local movex = pixelsx[pix]
local movey = pixelsy[pix]
local movez = pixelsz[pix]
lcd:translate(movex,movey,movez)
end
end
end
end
function addx()
if X == 9 then
X = 0
makelight()
numlist(0)
else
X = X + 1
makelight()
numlist(X)
end
end
function minx()
if X == 0 then
X = 9
makelight()
numlist(9)
else
X = X - 1
makelight()
numlist(X)
end
end
function add()
removelight()
addx()
end
function sub()
removelight()
minx()
end
makelight()
numlist(0)
if X == nil then
X = 0
end
Actually, I just realized I don't need timers for that anymore now that we can destroy entities.