[SOLVED]Update and remove object layers

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
User avatar
AdrianN
Citizen
Posts: 73
Joined: Wed Mar 28, 2018 5:13 pm
Location: Lima

[SOLVED]Update and remove object layers

Post by AdrianN »

Hi all.
Recently I have to make a 2d shooter (top down), in the game exist objects when I fired they are removed, like box (are object layers) and they have hp counter, but I have the problem to I can't delete or update the object layers
I used sti library to load the map
(box object layer, caja in spanish)
box.hp=100 -- exists
box.hp=box.hp-bullet.damage()-- collision
box.hp=0 -- remove

I tried to looking function in STI documentation, but nothing does work or only remove tile layer.

Image

Image
Last edited by AdrianN on Tue Jul 10, 2018 6:59 am, edited 1 time in total.
User avatar
AdrianN
Citizen
Posts: 73
Joined: Wed Mar 28, 2018 5:13 pm
Location: Lima

Re: Update and remove object layers

Post by AdrianN »

Edit:I used this code, looking in the forum and work for me, the sprite change

Code: Select all

for i, instance in ipairs(self.map.tileInstances[129]) do
      instance.batch:set(instance.id, self.map.tiles[265].quad, instance.x, instance.y)
end
But the collision still in the map, how I can change the properties (change collidable true to false).
I thinking to use the bump collision and change or is possible in sti (any function)
...anyone?

Code: Select all

for i=1,len do
	if collisions[i].other.name=="caja" then
		print(tostring(collisions[i].other.collidable))
		collisions[i].other.collidable=false
	end
end
like this code
Post Reply

Who is online

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