public WaterBullet( string spr, int x, int y )
 {
     pos = new Vector2( x, y );
     realpos = (Vector2f)pos;
     sprite = "~";
     color = 1;
 }
 public ExplodeyBullet( string spr, int x, int y )
 {
     pos = new Vector2( x, y );
     realpos = (Vector2f)pos;
     // Heh, unicode BULLET ;)
     color = 5;
     sprite = "*";
     attrs = Attrs.BOLD;
 }
 public override void Update( double dt )
 {
     realpos = realpos + direction;
     pos = (Vector2)realpos;
     Dingo dog = World.GetDog( pos );
     if ( dog != null ) {
         dog.Kill();
         Kill();
         return;
     }
     if ( !World.Passable( pos ) ) {
         Kill();
         return;
     }
 }
 public override void Update( double dt )
 {
     realpos = realpos + direction;
     pos = (Vector2)realpos;
     Dingo dog = World.GetDog( pos );
     if ( dog != null ) {
         dog.Kill();
         World.AddDynamicEntity( new Explosion( "*", pos.x, pos.y ) );
         Kill();
         return;
     }
     if ( !World.Passable( pos ) ) {
         World.AddDynamicEntity( new Explosion( "*", pos.x, pos.y ) );
         Kill();
         return;
     }
 }
Beispiel #5
0
 public void Shoot( Vector2f dir )
 {
     switch( gun ) {
         case "Water Gun": {
             WaterBullet b = new WaterBullet( "~", pos.x, pos.y );
             b.direction = dir;
             World.AddDynamicEntity( b );
             break;
                           }
         case "Cannon Gun": {
             Bullet b = new Bullet( "~", pos.x, pos.y );
             b.direction = dir;
             World.AddDynamicEntity( b );
             break;
                           }
         case "Confetti Gun": {
             ExplodeyBullet b = new ExplodeyBullet( "*", pos.x, pos.y );
             b.direction = dir;
             World.AddDynamicEntity( b );
             break;
                           }
     }
 }
Beispiel #6
0
 public double Distance( Vector2f b )
 {
     double dx = x-b.x;
     double dy = y-b.y;
     return Math.Sqrt( dx*dx + dy*dy );
 }