repl.it
@anonymous/

WatchfulOddballGnudebugger

Lua

No description

fork
loading
Files
  • main.lua
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
if message_id == hash("yourinfo")then 
	self.levelno = message[2]
	self.mystatus = message[1]
	self.levelplan = message[3]
	if message[1] == 0 then--level is not available. 
	elseif message[1] > 0 then --level is available, make image! 
		for key, value in pairs(self.levelplan) do
			self.placed = self.placed + 1 
			self.tiletype= {0,0,0,0}
			self.yvalue = (((self.placed%10)*64)+128)+64
			self.xvalue = (math.floor(self.placed/10)*64+128)
			if value == 9 or value == 5 or value == 8 or value == 7 or value == 6 then
				if self.levelplan[key-10] == nil or self.levelplan[key-10] == 0 then
					self.tiletype[3] = 1 --(left)
				end
				if self.levelplan[key+10] == nil or self.levelplan[key+10] == 0 then
					self.tiletype[4] = 1 (right)
				end
				if self.levelplan[key-1] == nil or self.levelplan[key-1] == 0 then
					self.tiletype[2] = 1 --(down)
				end
				if self.levelplan[key+1] == nil or self.levelplan[key+1] == 0 then
					self.tiletype[1] = 1 --(up)
				end
				self.props = { self.tiletype[1],self.tiletype[2],self.tiletype[3],self.tiletype[4] }
				factory.create("#tile", vmath.vector3(self.xvalue, self.yvalue, 0), nil, self.props, vmath.vector3(self.tilescale ,self.tilescale ,1))
			end
		end
	end
?