So I would use the following function. The sprite batch seems to be an opaque structure. How can I discover the sprite index for each dynamic object? I will investigate. Thanks.
Manipulating sprite batches is complicated and inefficient (when done sixty times per second). I made a table of dynamic objects containing body and tile pairs. There will not be many dynamic objects; this should be fast enough. I works well. Next step: fix the mass & inertia, maybe add friction...
Where in the map does the draw function get the x, y, and r ? I want to update dynamic object tiles (images) and tried updating the tileInstances table, but it has no effect. I looked at the main STI function (init.lua) and had a hard time following the code.
Hi, After looking more at the Box2D plugin code, I see that static elements of a tile can be associated with the main body (the first one created in box2d_init). For those, adding the tile position is required. The code must recognize this situation; there must be cooperation between the Box2D plugi...
Found the problem with rock object positions being off by a factor of two: vertices are relative to the object, do not add the position of the object. Here is the section of sti/plugin/box2d.lua elseif o.shape == "polygon" then -- Recalculate collision polygons inside tiles if tile then lo...
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 thin...
Agreed! I will create a new function. -- Update dynamic objects. It must be called after the physics -- update has run and before calling the STI draw function. -- box2d_update = function(map) -- One way to do this: -- - go through instances -- - find those on the object layer -- - find dynamic obje...
There are two options. 1) Replace the position and orientation entries in the STI table with references to the LÖVE2D physics engine values. They idea being that they refer to the same location in memory; that way the physics engine updates the values and STI uses them to draw. 2) Create a map:box2d...