6
* Creates dust effects for cannon ball hits land.
8
class DustCloudObject extends LiveObject
11
static var numClouds : Int = 10;
13
public function new( gd : GameDriver, atMP : Point2, size : Point2 )
16
this.at = atMP.clone();
17
this.size = size.clone();
19
actMode = LiveObject.actInvisible;
22
override function draw()
24
//leave old drawing there to add to quality (though perhaps too many circles?)
26
//needs to be adjusted to frequency if odl items are not removed...
27
for( i in 0...numClouds )
29
var c = draw.Color.int( 0x9e4c00 ).adjustBrightness( 0.5 + Math.random() ).asInt();
30
var x = Math.random() * size.x - size.x/2;
31
var y = Math.random() * size.y - size.y/2;
32
var cx = Math.random() * size.x / 2;
33
var cy = Math.random() * size.y / 2;
35
graphics.beginFill( c, Math.random() * 0.5 + 0.5 );
36
graphics.drawEllipse( x * GConst.gridSizeX, y * GConst.gridSizeY,
37
cx * GConst.gridSizeX, cy * GConst.gridSizeY );
42
override public function step( elapsed : Float ) : StepResult
44
curAlpha -= elapsed; //1 second for display
46
return StepResult.Remove;
49
size = size.mul( 1 + elapsed * 2 ); //slowly increase size
52
return StepResult.Changed;
b'\\ No newline at end of file'