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.
[SOLVED]Update and remove object layers
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[SOLVED]Update and remove object layers
Last edited by AdrianN on Tue Jul 10, 2018 6:59 am, edited 1 time in total.
Re: Update and remove object layers
Edit:I used this code, looking in the forum and work for me, the sprite change
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?
like this code
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
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
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], pgimeno and 48 guests