How can I add enemies randomly?


(Andressa Rebeca Pinheiro) #1

I have this in the update function of my world :

a=true; 	
	if(a)	{
	this.add(new Enemy()); // add enemies 		
}
			 		
super.update();	//tem que chamar update para executar o update method das entities.

but the image is becoming big. Like AAAAAAAA instead of just A A A…


(Jacob Albano) #2

There have been several threads about this in the last few days.

I don’t know exactly what you mean by “the image is becoming big”, but the reason there are so many "A"s is because you’re adding a new enemy every single frame (60 times per second).


(Andressa Rebeca Pinheiro) #3

Thank you so much. You are the flash. :smile:

Best Regards,