hi im trying to use this but im not sure how to add tile collision in the game (used tile collision editor window)
its problematic dealing with slopes right now ...
Simple Tiled Implementation - STI v1.2.3.0
Re: Simple Tiled Implementation - STI v0.16.0.3
Check the documentation for the "box2d" plugin. You need to set your tiles, objects, or layers to have the custom property "collidable" with a boolean value of "true".
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.16.0.3
Hi, Just started developing a roguelike game. And i have some questions about STI.
It's possible to rotate or invert a map?
And is it possible to change color of a map, like changing the RGB for it? Or change the tileset?
It's possible to rotate or invert a map?
And is it possible to change color of a map, like changing the RGB for it? Or change the tileset?
Re: Simple Tiled Implementation - STI v0.16.0.3
What do you mean by invert?
It should be possible to rotate the map:
You can use love.graphics.setColor before drawing the map to multiply a colour over the map.
You cannot change the tileset easily, but it is possible if you *really* want to.
It should be possible to rotate the map:
Code: Select all
function love.draw()
love.graphics.push()
love.graphics.rotate(math.pi)
map:draw()
love.graphics.pop()
end
You cannot change the tileset easily, but it is possible if you *really* want to.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.16.0.3
Boolean value didn't work for me. A string one did. (I've started with Tiled 0.9.something and STI 0.14.1.13)Karai17 wrote:Check the documentation for the "box2d" plugin. You need to set your tiles, objects, or layers to have the custom property "collidable" with a boolean value of "true".
This may be ineffective, but I've implemented color change by editing some STI's internals:sefan wrote:And is it possible to change color of a map, like changing the RGB for it?
Code: Select all
-- http://stackoverflow.com/a/7615129
function mysplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
--- Batch Tiles in Object Layer for improved draw speed
-- @param layer The Object Layer
-- @return nil
function Map:setObjectSpriteBatches(layer)
local newBatch = love.graphics.newSpriteBatch
local tw = self.tilewidth
local th = self.tileheight
local batches = {}
for _, object in ipairs(layer.objects) do
if object.gid then
local tile = self.tiles[object.gid] or self:setFlippedGID(object.gid)
local ts = tile.tileset
local image = self.tilesets[tile.tileset].image
batches[ts] = batches[ts] or newBatch(image, 1000)
local batch = batches[ts]
local tx = object.x + tw + tile.offset.x
local ty = object.y + tile.offset.y
local tr = math.rad(object.rotation)
local oy = 0
-- Compensation for scale/rotation shift
if tile.sx == 1 and tile.sy == 1 then
if tr ~= 0 then
ty = ty + th
oy = th
end
else
if tile.sx < 0 then tx = tx + tw end
if tile.sy < 0 then ty = ty + th end
if tr > 0 then tx = tx + tw end
if tr < 0 then ty = ty + th end
end
local props = object.properties or {}
if props.color then
batch:setColor(mysplit(props.color, ","))
else
batch:setColor(255,255,255)
end
id = batch:add(tile.quad, tx, ty, tr, tile.sx, tile.sy, 0, oy)
self.tileInstances[tile.gid] = self.tileInstances[tile.gid] or {}
table.insert(self.tileInstances[tile.gid], {
layer = layer,
batch = batch,
id = id,
gid = tile.gid,
x = tx,
y = ty,
r = tr,
oy = oy
})
end
end
layer.batches = batches
end
However, RGB is not something you (probably?) want. Look for some articles regarding HSV hue shift: http://stackoverflow.com/questions/8507 ... -rgb-color
The difference?
The easiest thing to do in order to change the tileset is to have a separate map file with different tileset in the code:sefan wrote:Or change the tileset?
Code: Select all
tilesets = {
{
name = "turbulence",
firstgid = 1,
tilewidth = 32,
tileheight = 32,
spacing = 0,
margin = 0,
image = "<HERE GOES YOUR TILESET>",
imagewidth = 128,
imageheight = 32,
...
Re: Simple Tiled Implementation - STI v0.16.0.3
Why use such old versions? Upgrade to the latest Tiled and STI!
Since tiled maps are just lua files, you don't need to "read" them at all. you can use love.filesystem.load to load them as lua wrapped in a function, so when you execute it you can jus tplace the map into a variable since it is just a big table. Fro mther eyou can just directly access the string holding the tileset and rpelace it with whatever tileset you want.
Since tiled maps are just lua files, you don't need to "read" them at all. you can use love.filesystem.load to load them as lua wrapped in a function, so when you execute it you can jus tplace the map into a variable since it is just a big table. Fro mther eyou can just directly access the string holding the tileset and rpelace it with whatever tileset you want.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.16.0.3
I've *started* with thoseKarai17 wrote:Why use such old versions? Upgrade to the latest Tiled and STI!
I'm using latest-dev Tiled as of now (doesn't really matter, since the official build is not that old).
As for STI... I haven't had any problems with it (except that 1000 typo), so never felt like upgrading.
I was telling the same... Now, was I?Karai17 wrote:...you can jus tplace the map into a variable...
... directly access the string holding the tileset and rpelace it with whatever tileset you want.
Guess at least it looked like I wasn't.
Edit:
Checked the STI commit list... Not so sure I should update while so in-core-dev of my project...
Guess I may have some workarounds I don't really know about which will turn into issues after an upgrade.
Re: Simple Tiled Implementation - STI v0.16.0.3
Thanks Karai17 and 4aiman
Invert was wrong word. I mean flip the map. So left side becomes the right side but top and bottom side stays. Or bottom side becomes top side but left and right side stays.Karai17 wrote:What do you mean by invert?
Think that is more what i was looking for.4aiman wrote:This works for object layer only, but can be used to add similar feature to any layer.
However, RGB is not something you (probably?) want. Look for some articles regarding HSV hue shift: http://stackoverflow.com/questions/8507 ... -rgb-color
Re: Simple Tiled Implementation - STI v0.18.1.0
I added several bug fixes and features. STI should now be in line with Tiled 0.18.1. Most notable change is that Map.drawRange has been removed. Instead of creating tile batches, I just use a single batch for each layer, no culling necessary. A potential rendering bug in staggered and hexagonal maps has also been fixed, and the issue with collision objects being incorrectly offset when offsetting maps should now be fixed as well.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.18.1.0
You shouldn't have removed it. Instead, you should've added an option to draw entire layer as a single batch. On some computers, rendering hundreds of thousands of sprites may be extremely slow and only rendering a few hundred would be a serious improvement.
Who is online
Users browsing this forum: No registered users and 1 guest