[SOLVED] How to disable entity's PixelMask

(Zouhair Elamrani Abou Elassad) #1


Is there a way to disable an entity’s Mask to avoid clissions, i tried : Entity.collidable = false & Entity.visible = false.

Both of them didn’t seem to work.

Thank You.

(Zouhair Elamrani Abou Elassad) #2


I’m back with good news, i managed to find a solution to get the job done :slight_smile: :

 public function setEntityAlpha(myEntity:Entity, alpha:uint = 0):void 

	  var pixMask:Pixelmask = myEntity.mask as Pixelmask;
	  var data:BitmapData =  pixMask.data;
	  (alpha == 0) ? pixMask.width = 0 : pixMask.width = pixMask.data.width;

Have Fun.

(Zachary Lewis) #3

How are you performing the collision checks? I believe

myEntity.collidable = false;

should disable collision checks against that entity.

(Zouhair Elamrani Abou Elassad) #4

I’m checking collisions with the mouse like this :

override public function update():void 
		_mouseover = collidePoint(x, y , world.mouseX, world.mouseY);
		if (_mouseover) {
			if (Input.mouseReleased) clickMenuButton();


I did try the Entity.collidable = false, but it didn’t work out.