Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function love.load()
- map = {} -- 64x48
- for x=0, 63 do
- map[x] = {}
- for y=0, 47 do
- map[x][y] = 0
- end
- end
- convert = 0
- love.graphics.setMode(1024, 768, false)
- end
- function love.update()
- if love.mouse.isDown("l") then
- x = love.mouse.getX()
- y = love.mouse.getY()
- map[math.floor(x/16)][math.floor(y/16)] = convert
- end
- end
- function love.keypressed(key)
- if key == "1" then convert = 0 end
- if key == "2" then convert = 1 end
- if key == "3" then convert = 2 end
- if key == "4" then convert = 3 end
- if key == "return" then
- for x=0, 63 do
- local str = ""
- for y=0, 47 do
- str = str .. "0"..map[x][y].."0"..map[x][y].." "
- end
- print("fb "..str)
- end
- end
- end
- function love.draw()
- for x=0, 63 do
- for y=0, 47 do
- if map[x][y] ~= 0 then
- if map[x][y] == 1 then
- love.graphics.setColor(255, 0, 0)
- end
- if map[x][y] == 2 then
- love.graphics.setColor(0, 0, 255)
- end
- if map[x][y] == 3 then
- love.graphics.setColor(0, 255, 0)
- end
- love.graphics.rectangle("fill", x*16, y*16, 16, 16)
- end
- love.graphics.setColor(127, 127, 127)
- if math.floor(love.mouse.getX()/16) == x and math.floor(love.mouse.getY()/16) == y then
- if convert == 0 then
- love.graphics.setColor(0, 0, 0)
- end
- if convert == 1 then
- love.graphics.setColor(255, 0, 0)
- end
- if convert == 2 then
- love.graphics.setColor(0, 0, 255)
- end
- if convert == 3 then
- love.graphics.setColor(0, 255, 0)
- end
- end
- love.graphics.printf(map[x][y], x*16, y*16, 16, "right")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment