Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Maze generation --
- local MZ = {}
- SZ = 100
- for x = 1,SZ do
- for y = 1,SZ do
- local N = {}
- N.X = x
- N.Y = y
- N.Taken = false
- table.insert(MZ,N)
- end
- end
- for i,v in pairs(MZ) do
- Sides = {Top = MZ[i-SZ],
- Bottom = MZ[i+SZ],
- Front = MZ[i+1],
- Back = MZ[i-1],
- TopRight = MZ[i-(SZ-1)],
- TopLeft = MZ[i-(SZ+1)],
- BottomLeft = MZ[i+(SZ-1)],
- BottomRight = MZ[i+(SZ+1)]}
- if Sides.Top and Sides.Bottom and Sides.Front and Sides.Back and Sides.TopRight and Sides.TopLeft and Sides.BottomLeft and Sides.BottomRight then
- local N = math.random(1,8)
- local G = Sides[N]
- if G and G.Taken == false then
- v.Taken = true
- end
- local TK = true
- for i,v in pairs(Sides) do
- if v.Taken then
- TK = false
- end
- end
- v.Taken = TK
- end
- end
- GS = 5
- Player=game.Players.LocalPlayer
- PlayerGui=Player:WaitForChild("PlayerGui")
- Screen=Instance.new("ScreenGui",PlayerGui)
- for i,v in pairs(MZ) do
- if v.Taken then
- local S = Instance.new("Frame",Screen)
- S.Size = UDim2.new(0,GS,0,GS)
- S.Position = UDim2.new(0,v.X*GS,0,v.Y*GS)
- else
- local S = Instance.new("Frame",Screen)
- S.Size = UDim2.new(0,GS,0,GS)
- S.Position = UDim2.new(0,v.X*GS,0,v.Y*GS)
- S.BackgroundColor3 = Color3.new(0,0,0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement