Search found 30 matches

by ClaudeM
Tue Dec 28, 2021 10:26 pm
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

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.

Code: Select all

SpriteBatch:set( spriteindex, x, y, r, sx, sy, ox, oy, kx, ky )
by ClaudeM
Mon Dec 27, 2021 5:19 pm
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

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...
by ClaudeM
Fri Dec 24, 2021 1:01 am
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

Hi Karai17,

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.

Thanks.
by ClaudeM
Fri Dec 10, 2021 4:20 pm
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

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...
by ClaudeM
Wed Dec 08, 2021 2:07 am
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

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...
by ClaudeM
Sun Dec 05, 2021 10:27 pm
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

P. S. I tried using your map with the example in the STI GitHub page and also got a blank window. I suggest starting with that code.

https://github.com/karai17/Simple-Tiled-Implementation
by ClaudeM
Sun Dec 05, 2021 10:24 pm
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

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...
by ClaudeM
Sat Dec 04, 2021 1:11 am
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

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...
by ClaudeM
Fri Dec 03, 2021 3:45 pm
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

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...
by ClaudeM
Fri Dec 03, 2021 2:22 am
Forum: Libraries and Tools
Topic: Simple Tiled Implementation - STI v1.2.3.0
Replies: 914
Views: 743495

Re: Simple Tiled Implementation - STI v1.2.3.0

How are object positions updated in response to physics engine updates? I do not know how to establish that link.