~eda-qa/dhlib/main

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package fortress;

import mathx.Point2;

/**
 * Creates ripples in the water when a cannon ball hits water
 */
class InvalidShotObject extends LiveObject
{
	var time : Float;
	
	public function new( gd : GameDriver, atMP : Point2 )
	{
		super( gd );
		at = atMP.clone();
		time = 0.3;
		actMode = LiveObject.actInvisible;
		player = false;	//doesn't belong to anyone
		
		draw();
	}
	
	override function draw()
	{
		graphics.clear();
		
		var st = Math.cos( Math.PI/4 );
		graphics.lineStyle( GConst.gridSizeX/7.5, 0x800000, 0.9, true );
		graphics.moveTo( st * -GConst.gridSizeX/3, st * -GConst.gridSizeY/3 );
		graphics.lineTo( st* GConst.gridSizeX/3, st * GConst.gridSizeY/3 );
		graphics.drawEllipse( -GConst.gridSizeX/3, -GConst.gridSizeY/3,
			2*GConst.gridSizeX/3, 2*GConst.gridSizeY/3 );
	}
	
	override public function step( elapsed : Float ) : StepResult
	{
		time -= elapsed;
		if( time <= 0 )
			return StepResult.Remove;
			
		return StepResult.Nothing;
	}
}