getType not working everytime


(Darrin) #1

So I have a work around but I thought I bring this up. In my update, I use getType to get lists to detect collisions. It is fine if I use a getType, the do some sort of loop. However on one class it will not load the entities. Naming conventions are all correct, type is correctly set to “rock” etc. I use hitlist a few times above with getType and getList. Any ideas?

			hitList.length = 0;		
		//getClass(Rock, hitList);  // <--- work around
		getType("rock", hitList);	// <--- does not work, loads nothing. 		
		var waveList:Array = [];
		getType("wave", waveList);			

Here is the entity.

		public function Rock(difficulty:String) 
	{			
		spriteMap  = new Spritemap(Main.art.getBitmap("ROCKFRAG").bitmapData, 82, 138, null);
		graphic = spriteMap;
		spriteMap.add("normal", [0], 15, true);
		spriteMap.add("explode", [1, 2, 3, 4, 5], 15, false);
		spriteMap.play("normal");
		setHitbox(32, 92, -25, -23);
		type = "rock";

(Martí Angelats i Ribera) #2

Where is this function? In an Entity?


(Darrin) #3

The top is in the World update.
The bottom is the Rock class constructor.