Re: Simple Tiled Implementation - STI v1.2.3.0
Posted: Sun Dec 05, 2021 10:24 pm
Hi markusm,
I am also new to LÖVE2D. I started with a very simple « click on the target » game from a video on YouTube. I then build Bulldozer in steps: I got a copy of Tiled (the editor), found a tile set I liked, made a map, and loaded it in a rudimentary game (it did almost nothing). I added things to it one at a time: sound, an object layer, and the bulldozer. I added LÖVE2D physics later; it took a long time to get the bulldozer moving well.
I then worked on collisions with physics. LÖVE2D uses the Box2D library; it is excellent and well known. This is a complex element of the game. I made the choice to use physics because later stages of the game will benefit from it (e.g., you cannot push too many rocks at a time). You may not need physics; one alternative is bump https://love2d.org/wiki/bump.lua.
When I started having difficulty with collisions, I made a smaller 8 x 8 map with only one rock. I added a lot of print statements to see what was happening. Print is your friend. If there is a lot of output, pipe it into a file you can examine more conveniently with something like the 'less' command.
The world.lua file you provided is quite different from the one I am using. I have not seen chunks before, but may not mean much since I am a beginner with Tiled editor. Here is a half-size screenshot of Tiled with my small testing map. I put the ground tiles in one layer and the rock on an object layer. You can see the dashed lines of the collision boxes; I added those to the tile-set.
There are other tricks with using Tiled. It took me a while to learn.
Good luck in your development.
I am also new to LÖVE2D. I started with a very simple « click on the target » game from a video on YouTube. I then build Bulldozer in steps: I got a copy of Tiled (the editor), found a tile set I liked, made a map, and loaded it in a rudimentary game (it did almost nothing). I added things to it one at a time: sound, an object layer, and the bulldozer. I added LÖVE2D physics later; it took a long time to get the bulldozer moving well.
I then worked on collisions with physics. LÖVE2D uses the Box2D library; it is excellent and well known. This is a complex element of the game. I made the choice to use physics because later stages of the game will benefit from it (e.g., you cannot push too many rocks at a time). You may not need physics; one alternative is bump https://love2d.org/wiki/bump.lua.
When I started having difficulty with collisions, I made a smaller 8 x 8 map with only one rock. I added a lot of print statements to see what was happening. Print is your friend. If there is a lot of output, pipe it into a file you can examine more conveniently with something like the 'less' command.
The world.lua file you provided is quite different from the one I am using. I have not seen chunks before, but may not mean much since I am a beginner with Tiled editor. Here is a half-size screenshot of Tiled with my small testing map. I put the ground tiles in one layer and the rock on an object layer. You can see the dashed lines of the collision boxes; I added those to the tile-set.
There are other tricks with using Tiled. It took me a while to learn.
Good luck in your development.