Combining STI and procedural content?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
m0nkeybl1tz
Prole
Posts: 14
Joined: Fri Jan 22, 2016 3:25 am

Combining STI and procedural content?

Post by m0nkeybl1tz »

Hey all, I just started playing around with STI and find it's super easy to set up a map using Tiled. However, I want parts of my game to be procedural (for example, placing items at random locations) and I'm having a hard time adding items to the STI map after it's initialized. For example, I created a helper function to the bump.lua script to add new physics objects to the scene:

Code: Select all

	bump_add = function(map, block, x,y,w,h)
		map.bump_world:add(block, x,y,w,h)
	end
But when I run it, I get an error saying that 'add' is a nil value. Has anyone had luck adding objects to a STI map at runtime? Is there something I'm missing? Or would it be better to maintain a separate map of objects, and just making sure you offset both maps together as the player moves?
m0nkeybl1tz
Prole
Posts: 14
Joined: Fri Jan 22, 2016 3:25 am

Re: Combining STI and procedural content?

Post by m0nkeybl1tz »

Well, I feel silly. I figured out that even though STI comes with a bump.lua script, it doesn't fully implement BUMP. Instead, you need to download and add BUMP separately, then you can call world:add (I was doubly confused because love.physics.world and bump.world implement some, but not all, of the same methods).
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 11 guests