~eda-qa/dhlib/main

« back to all changes in this revision

Viewing changes to restricted/app-fortress/fortress/InvalidShotObject.hx

  • Committer: edA-qa mort-ora-y
  • Date: 2010-02-16 05:36:32 UTC
  • Revision ID: eda-qa@disemia.com-20100216053632-60lt7fndfi3fgblw
first

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package fortress;
 
2
 
 
3
import mathx.Point2;
 
4
 
 
5
/**
 
6
 * Creates ripples in the water when a cannon ball hits water
 
7
 */
 
8
class InvalidShotObject extends LiveObject
 
9
{
 
10
        var time : Float;
 
11
        
 
12
        public function new( gd : GameDriver, atMP : Point2 )
 
13
        {
 
14
                super( gd );
 
15
                at = atMP.clone();
 
16
                time = 0.3;
 
17
                actMode = LiveObject.actInvisible;
 
18
                player = false; //doesn't belong to anyone
 
19
                
 
20
                draw();
 
21
        }
 
22
        
 
23
        override function draw()
 
24
        {
 
25
                graphics.clear();
 
26
                
 
27
                var st = Math.cos( Math.PI/4 );
 
28
                graphics.lineStyle( GConst.gridSizeX/7.5, 0x800000, 0.9, true );
 
29
                graphics.moveTo( st * -GConst.gridSizeX/3, st * -GConst.gridSizeY/3 );
 
30
                graphics.lineTo( st* GConst.gridSizeX/3, st * GConst.gridSizeY/3 );
 
31
                graphics.drawEllipse( -GConst.gridSizeX/3, -GConst.gridSizeY/3,
 
32
                        2*GConst.gridSizeX/3, 2*GConst.gridSizeY/3 );
 
33
        }
 
34
        
 
35
        override public function step( elapsed : Float ) : StepResult
 
36
        {
 
37
                time -= elapsed;
 
38
                if( time <= 0 )
 
39
                        return StepResult.Remove;
 
40
                        
 
41
                return StepResult.Nothing;
 
42
        }
 
43
}