Jump to content

Killing an sprite in object


divers
 Share

Recommended Posts

Hello, as in the topic:

for(var i = cubes.length-1; i > ile*ile-1; i--)
{
cubes[i].temp.kill();
cubes.splice(i,1); 
}


function Cube(i){
	
	this.i = i;
		
	this.show = function(x,y,target){
			
		if(target == 1)
			this.temp = game.add.sprite(x, y, 'rect2');		
		else
			this.temp = game.add.sprite(x, y, 'rect');

		this.temp.inputEnabled = true;
		this.temp.events.onInputDown.add(onTap, this, 0, this.i);

	}
	
		
}

My array is splicing correctly, but the sprites are still displaying.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...