I had run into a issue, some of my tiles are not actually a full 32x32 solid, one is 13x32 pixels, so i had to make a change to my builder to look at the gid and have a separate file provide how the shape is made.
THEN having to deal with many physics things on large maps made me wonder if i could optimize this, blending tiles together into a single shape. ie a 64x64 map whos boundaries are full 32x32 solids. If i optimize this map i can have instead 256 objects but 4 (4 walls)
So i also noticed what about my 13x32 solid tiles? Another file would provide how tile A "blends" its shape into tile B to form a single shape.
Iterating only along the X-axis making long horizontal shapes out tiles that are adjacent to each other was my goal (i would deal with the Y axis afterwards)
I failed miserably, It did blend, but when i tried including the 13x32 tiles i couldnt wrap my head around the coordinate information.
--==--==--==--==--==--==--==--==--
In the short stack, instead of using STI per Tile collision, i simply defined some rectangles in Tiled and set those as Collidable for STI.
I have a request though. Can you please make it so that the fixture or container of the fixture and shape created by STI also have a variable that points to the object that STI used. IE in the collisions table returned by initWorldCollision :
Code: Select all
--collisions - the table from [:initWorldCollision]
--map - the map created at somepoint by [sti.new]
if collisions[1].initializer.gid == map.tileInstances[1][1].gid then
print("The Collision object at index 1 is same gid as the first tile!")
end
At the moment i assume all collidables are "ground" tiles, and on collision with a contact normal.y that puts the player ontop the ground_tile sets a variable that lets the player move or jump, but it would be nice to say if the tile is a slippery tile then set a variable that changes the slipperiness of the players movements etc etc
End.
print("Thanks for STI anyhow...")