scottc
October 16th, 2008, 03:33 AM
I'm making a worms / leiro type game..
And I'm trying to make the ground change color around the "explosions" so it looks like the ground is burnt.
this is what i have so far:
public function blastCircle(x:int,y:int,r:uint):void{
//make temp circle to cut hole
var c:Sprite = new Sprite();
c.graphics.beginFill(0x000000);
c.graphics.drawCircle(x, y, r+1);
c.graphics.endFill();
//make a black circle that only affects opaque pixels
draw(c, null, new ColorTransform(1,1,1,0.5,0,0,0,0));
c.graphics.clear();
c.graphics.beginFill(0xFFFFFF);
c.graphics.drawCircle(x, y, r);
c.graphics.endFill();
draw(c, null, null, "erase");
//resetPalette();
}
You can see what i've got so far (http://scottcampbell.com.au/flash/terrain_destruction_game_engine) (without the black ring code).
I cant seem to find the correct blend mode or color transformation etc to make it affect only opaque pixels. so i end up with the burnt area also affecting the "air".
And I'm trying to make the ground change color around the "explosions" so it looks like the ground is burnt.
this is what i have so far:
public function blastCircle(x:int,y:int,r:uint):void{
//make temp circle to cut hole
var c:Sprite = new Sprite();
c.graphics.beginFill(0x000000);
c.graphics.drawCircle(x, y, r+1);
c.graphics.endFill();
//make a black circle that only affects opaque pixels
draw(c, null, new ColorTransform(1,1,1,0.5,0,0,0,0));
c.graphics.clear();
c.graphics.beginFill(0xFFFFFF);
c.graphics.drawCircle(x, y, r);
c.graphics.endFill();
draw(c, null, null, "erase");
//resetPalette();
}
You can see what i've got so far (http://scottcampbell.com.au/flash/terrain_destruction_game_engine) (without the black ring code).
I cant seem to find the correct blend mode or color transformation etc to make it affect only opaque pixels. so i end up with the burnt area also affecting the "air".