KingRecycle wrote:
Well it checks if the next tile has the obstacle property. Takes the tile the player is on and adds to it the direction the player is moving for the next tile.
So if the next tile is an obstacle tile it doesn't let the player move that direction.
All right. It looks like you are testing if the collision is happening on the current location of the player rather than where the player will be at. So that would let the player move onto an obstacle but never off of it.
KingRecycle wrote:
Well it checks if the next tile has the obstacle property. Takes the tile the player is on and adds to it the direction the player is moving for the next tile.
So if the next tile is an obstacle tile it doesn't let the player move that direction.
All right. It looks like you are testing if the collision is happening on the current location of the player rather than where the player will be at. So that would let the player move onto an obstacle but never off of it.
I've already changed so much of the code since I last posted.
I been trying to get movement like you see in the Pokemon games but to no avail.
I was doing so many things that I destroyed the current code and probably going to start from the example again.
If you have any idea how I can get movement as I said above and also do obstacle checking then I will appreciate it a lot as I been trying to do this since last thursday.
Sorry if this has been asked already, but does Tiled come with a built in tile animation feature or auto-tiling features? I guess animations could be done by setting tile properties, but it seems like it would be a common thing. If these features exist, does your loader support them?
KingRecycle wrote:
I've already changed so much of the code since I last posted.
I been trying to get movement like you see in the Pokemon games but to no avail.
I was doing so many things that I destroyed the current code and probably going to start from the example again.
If you have any idea how I can get movement as I said above and also do obstacle checking then I will appreciate it a lot as I been trying to do this since last thursday.
You might want to tackle the movement code separately and come back once you have a good feel for it. Try and do the Gridlocked Player tutorial and post in the support and development forum if you have trouble. Your question will get a lot more exposure and get answered faster there. Also the ATL examples are really bad to build off of. They are meant to just get things moving around and show how to do basic operations. I suppose I need to get around to doing proper tutorials.
litearc wrote:Sorry if this has been asked already, but does Tiled come with a built in tile animation feature or auto-tiling features? I guess animations could be done by setting tile properties, but it seems like it would be a common thing. If these features exist, does your loader support them?
Tiled does have an automapping feature but no animations. I believe that the output for automaps are the same as regular maps so ATL should be able to handle them.
Hi everyone! This is my first post in the Love2d forums.
I've started playing around with ATL and it's pretty great, but I've run into a small problem.
I'm trying to write to my tilemap so I can have animated tiles in-game.
I have a simple *.tmx with one layer and one tileset. Here's my code for loading the map and attempting to alter a tile:
local stone = {}
local layer = map.tileLayers["ground"]
for x, y, tile in layer.tileData:iterate() do
if tile.properties.type == "stone" then
stone[ #stone+1 ] = tile
end
end
KingRecycle wrote:It's probably posted somewhere but I didn't see it but is there a way to hide objects (not remove)?
You can hide all objects by setting map.drawObjects to false. You can't hide individual objects.
local stone = {}
local layer = map.tileLayers["ground"]
for x, y, tile in layer.tileData:iterate() do
if tile.properties.type == "stone" then
stone[ #stone+1 ] = tile
end
end
And now if I want to print the x and y i have to...?
local stone = {}
local layer = map.tileLayers["ground"]
for x, y, tile in layer.tileData:iterate() do
if tile.properties.type == "stone" then
stone.tile = tile -- Store the stone tile object
stone[ #stone+1 ] = {x=x, y=y} -- Store the location
end
end
After you run that code then the stone table will hold the information about the tile.
stone.tile will be the Tile object itself
stone[1] will be the first stone tile location
stone[2] will be the second stone tile location
etc...
So to print the first (or only) tile then you would do this: