Simple Tiled Implementation - STI v1.2.3.0
Re: Simple Tiled Implementation
Aye, I plan to implement real-time updating of tile data.
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é
- Daniel Eakins
- Citizen
- Posts: 99
- Joined: Thu Jul 18, 2013 9:14 pm
- Location: France
Re: Simple Tiled Implementation
Awesome!Karai17 wrote:Aye, I plan to implement real-time updating of tile data.
Re: Simple Tiled Implementation
If the code grows, I'll probably abstract it into several files. Only time will tell.bekey wrote:Will the library later be expanded into multiple files, or is that out of the intentional scope?
Edit: I updated the love file to allow a bit of human input. You can now move around the map and shift your speed a bit.
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
Yey, thanks for this!
Re: Simple Tiled Implementation
Did a minorish update, fixed a small bug, and updated the Tech Demo love file.
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
The Lua export feature wasn't implemented yet when I first created ATL or I most likely would have based it on that. Last I looked it actually tosses out some minor map data so be careful. Also it doesn't do any sort of compression so very large maps can actually take up a good chunk of memory. Those reasons, and the convenience of being able to directly load the native Tiled format is the reason I stuck with TMX (also it doesn't have to be nearly as complicated or slow as I made it).Karai17 wrote:You can think of the TMX file as a project file, and the exported JSON/Lua as a program-ready file. I'm not sure if Kadoba was aware that Tiled exported directly to Lua since ATL made use of XML parsing, but STI uses the native Lua spec so hopefully it will load files faster and allow more flexibility when working with the map table.
Anyway, I'm glad to see an alternative to ATL being made so good luck with the project.
Re: Simple Tiled Implementation - STI v0.2.1
I'm glad you approve!
I actually talked with Bjorn (Tiled Dev) and the lua file has come a long way, holding virtually all the data that the XML holds. It is definitely the better option at this point in time.
Edit: Updated the lib/love file to include collision layer support!
I actually talked with Bjorn (Tiled Dev) and the lua file has come a long way, holding virtually all the data that the XML holds. It is definitely the better option at this point in time.
Edit: Updated the lib/love file to include collision layer support!
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.3.1
¡Double post!
This library is officially useful now (though drawing still needs an efficiency overhaul). With the new Custom Layer feature, you can add in your own data to a layer. Custom Layers also have a draw callback that you can override for your own needs. Currently you need to add a dummy layer in Tiled and then convert that layer using Map:convertToCustomLayer(layer), but I may add the ability to create a new Custom Layer in the future.
This library is officially useful now (though drawing still needs an efficiency overhaul). With the new Custom Layer feature, you can add in your own data to a layer. Custom Layers also have a draw callback that you can override for your own needs. Currently you need to add a dummy layer in Tiled and then convert that layer using Map:convertToCustomLayer(layer), but I may add the ability to create a new Custom Layer in the future.
Code: Select all
local sti = require "libs.sti"
function love.load()
map = sti.new("assets/maps/map01")
local spriteLayer = map.layers["Sprite Layer"]
map:convertToCustomLayer("Sprite Layer")
spriteLayer.sprite = {
x = 64,
y = 64,
image = love.graphics.newImage("sprite.png"),
}
function spriteLayer:update(dt)
self.sprite.r = self.sprite.r + 90 * dt
end
function spriteLayer:draw()
local x = math.floor(self.sprite.x)
local y = math.floor(self.sprite.y)
love.graphics.draw(self.sprite.image, x, y)
end
end
function love.update(dt)
local sprite = map.layers["Sprite Layer"].sprite
local down = love.keyboard.isDown
local speed = 64 -- pixels per second
if down("w") or down("up") then sprite.y = sprite.y - speed * dt end
if down("s") or down("down") then sprite.y = sprite.y + speed * dt end
if down("a") or down("left") then sprite.x = sprite.x - speed * dt end
if down("d") or down("right") then sprite.x = sprite.x + speed * dt end
map:update(dt)
end
function love.draw()
local sprite = map.layers["Sprite Layer"].sprite
love.graphics.push()
local tx = math.floor(-sprite.x + 384)
local ty = math.floor(-sprite.y + 284)
love.graphics.translate(tx, ty)
map:draw()
love.graphics.pop()
end
Last edited by Karai17 on Thu Jan 16, 2014 8:57 pm, edited 1 time in total.
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é
-
- Party member
- Posts: 356
- Joined: Wed Jul 03, 2013 4:06 am
Re: Simple Tiled Implementation - STI v0.3.1
How do you plan on handling objects? I am curious about this. When I was working on my own Tiled loader, I was just referencing them and then creating in game objects based on an ID I assigned to them. Wasn't a lot of fun to work with that way (eg: cheap hack!). I'm working on the Tiled importer for Greentea, and was just wondering on what you plan on doing/how it will compare/etc to other libs way of doing it (Lovely Tiles, etc).
Also- Bjorn is awesome, no? One of the nicest people ever. A kick ass programmer, too.
Will you be letting users draw each layer separately? Or move each layer separately? For things like parallax scrolling, etc.
Also- Bjorn is awesome, no? One of the nicest people ever. A kick ass programmer, too.
Will you be letting users draw each layer separately? Or move each layer separately? For things like parallax scrolling, etc.
Who is online
Users browsing this forum: Bing [Bot] and 1 guest