I started using Love2D yesterday and I am experiencing a rather strange issue with Tiled and AdvTiledLoader.
This is my code:
Code: Select all
lick = require "lick"
lick.reset = true
TILE_SIZE = 25
MAP_WIDTH = 26
MAP_HEIGHT = 24
N_MAPS = 1
function love.load()
-- Set up player
player = {}
player.x = 0
player.y = 0
player.speed = 1000
-- Load all map images
map_loader = require("AdvTiledLoader.Loader")
map_loader.path = "maps/"
maps = {}
for i = 1, N_MAPS do
maps[i] = map_loader.load("map" .. i .. ".tmx")
end
end
function love.update(dt)
if love.keyboard.isDown("right") then
player.x = player.x + player.speed * dt
end
if love.keyboard.isDown("left") then
player.x = player.x - player.speed * dt
end
if love.keyboard.isDown("down") then
player.y = player.y + player.speed * dt
end
if love.keyboard.isDown("up") then
player.y = player.y - player.speed * dt
end
end
function love.draw()
love.graphics.push()
maps[1]:draw()
love.graphics.pop()
--love.graphics.rectangle("fill", player.x, player.y, TILE_SIZE, TILE_SIZE)
end
111111
100001
100001
111111
It's a square, with gray blocks on borders and filled with black. However, when I draw it, I get this:
I don't see the first row and the first column for some reason, but they are there, I drew and can see them on Tiled.
Any idea? Thank you.