Pixel Collision Multiple Objects

Hi There!

We are currently working on a game for Uni. However, pixel collision which was a requirement is being rather annoying. Basically, the first collision for the maze works (Whereby if the character hits the wall, he’s position will change back to 20 20) yet once level 1 has changed, and Maze Level 2 is loaded, the character can go through the walls. Here is what we have:

		public static function checkPixelCollisionEvent(e:Event)		{
			if (checkPixelCollision(character,mazel1,mazel2))
				{
					character.x = 20;
					character.y = 20;
				}
				
				
		}
		
		// Check Pixel Collision 
		public static function checkPixelCollision(obj1:MovieClip, obj2:MovieClip, obj3:MovieClip):Boolean
		{
			var obj1ClipBmpData = new BitmapData(obj1.width, obj1.height, true, 0);
			obj1ClipBmpData.draw(obj1);
			
			var obj2ClipBmpData = new BitmapData(obj2.width, obj2.height, true, 0)
			obj2ClipBmpData.draw(obj2);
			
			var obj3ClipBmpData = new BitmapData(obj3.width, obj3.height, true, 0)
			obj3ClipBmpData.draw(obj3);
			
			return obj1ClipBmpData.hitTest(new Point(obj1.x, obj1.y), 255, obj2ClipBmpData, new Point (obj2.x, obj2.y), 255)
			return obj1ClipBmpData.hitTest(new Point(obj1.x, obj1.y), 255, obj3ClipBmpData, new Point (obj3.x, obj3.y), 255)
		}

as you can see, we thought by adding object 3, it would detect, but it doesn’t :frowning: