Beispiel #1
0
 protected void CheckIfCrashed(SkyKidGame world)
 {
     //check to see if corners of sprite collide with world.
     if (world.Level.collide(X, Y) || world.Level.collide(X + Width, Y) || world.Level.collide(X, Y + Height) || world.Level.collide(X + Width, Y + Height))
     {
         Dead = true;
         // TODO: play once??????
         Animation.AutoAnimateOnce("dead", 0);
     }
 }
Beispiel #2
0
 protected void CheckForBulletCollide(SkyKidGame world)
 {
     foreach (SkyKidGame.Bullet b in SkyKidGame.Bullets)
     {
         if (SkyKidGame.Collide(b.x, b.y, 1, 1, X, Y, Width, Height))
         {
             Dead = true;
             Animation.AutoAnimateOnce("dead", 0);
         }
     }
 }
Beispiel #3
0
 public void ShootBullets(SkyKidGame world)
 {
     if(FramesUntilCanShootAgain == 0)
     {
         FramesUntilCanShootAgain = FramesPerShot;
         SkyKidGame.Bullet b = new SkyKidGame.Bullet();
         b.x = X + Width + 2;
         b.y = Y + 5;
         b.left = false;
         SkyKidGame.Bullets.AddFirst(b);
     }
 }
Beispiel #4
0
 public void ShootBullets(SkyKidGame world)
 {
     if (FramesUntilCanShootAgain == 0)
     {
         FramesUntilCanShootAgain = FramesPerShot;
         SkyKidGame.Bullet b = new SkyKidGame.Bullet();
         b.x    = X + Width + 2;
         b.y    = Y + 5;
         b.left = false;
         SkyKidGame.Bullets.AddFirst(b);
     }
 }
Beispiel #5
0
 private void CheckForShoot(SkyKidGame world, KeyboardState ks)
 {
     if (ks.IsKeyDown(Keys.A) && FramesUntilCanShootAgain == 0)
     {
         FramesUntilCanShootAgain = FramesPerShot;
         SkyKidGame.Bullet b = new SkyKidGame.Bullet();
         //Arbitrarily decide where to spawn bullet
         b.x = X - 2;
         b.y = Y + 5;
         b.left = true;
         SkyKidGame.Bullets.AddFirst(b);
     }
 }
Beispiel #6
0
 private void CheckForShoot(SkyKidGame world, KeyboardState ks)
 {
     if (ks.IsKeyDown(Keys.A) && FramesUntilCanShootAgain == 0)
     {
         FramesUntilCanShootAgain = FramesPerShot;
         SkyKidGame.Bullet b = new SkyKidGame.Bullet();
         //Arbitrarily decide where to spawn bullet
         b.x = X - 2;
         b.y = Y + 5;
         b.left = true;
         SkyKidGame.Bullets.AddFirst(b);
     }
 }
Beispiel #7
0
    private void MovePlane(SkyKidGame world, KeyboardState ks)
    {
        // X
        if (ks.IsKeyDown(Keys.Left) && X > world.CamX)
            X -= 5;
        else if (ks.IsKeyDown(Keys.Right) && X < world.CamX + SkyKidGame.BaseWidth + -Width)
            X -= 1;
        else X -= 3;

        // Y
        if (ks.IsKeyDown(Keys.Down))
            Y += 3;
        else if (ks.IsKeyDown(Keys.Up))
            Y -= 3;
    }
Beispiel #8
0
    private void MovePlane(SkyKidGame world, KeyboardState ks)
    {
        // X
        if (ks.IsKeyDown(Keys.Left) && X > world.CamX)
            X -= 5;
        else if (ks.IsKeyDown(Keys.Right) && X < world.CamX + SkyKidGame.BaseWidth + -Width)
            X -= 1;
        else X -= 3;

        // Y
        if (ks.IsKeyDown(Keys.Down))
            Y += 3;
        else if (ks.IsKeyDown(Keys.Up))
            Y -= 3;
    }
Beispiel #9
0
    public void update(SkyKidGame world)
    {
        if (FramesUntilCanShootAgain != 0)
            FramesUntilCanShootAgain--;

        if (!Dead)
        {

            X++;
            CheckIfCrashed(world);
            CheckForBulletCollide(world);
            ShootBullets(world);
        }

        Animation.Update();
    }
Beispiel #10
0
    public void update(SkyKidGame world,KeyboardState ks)
    {
        if (FramesUntilCanShootAgain != 0)
            FramesUntilCanShootAgain--;

        if (!Dead)
        {
            MovePlane(world, ks);
            CheckForShoot(world, ks);
            CheckIfCrashed(world);
            CheckForBulletCollide(world);

        }

        Animation.Update();
    }
Beispiel #11
0
    public void update(SkyKidGame world,KeyboardState ks)
    {
        if (FramesUntilCanShootAgain != 0)
            FramesUntilCanShootAgain--;

        if (!Dead)
        {
            MovePlane(world, ks);
            CheckForShoot(world, ks);
            CheckIfCrashed(world);
            CheckForBulletCollide(world);

        }

        Animation.Update();
    }
Beispiel #12
0
    public void update(SkyKidGame world)
    {
        if (FramesUntilCanShootAgain != 0)
        {
            FramesUntilCanShootAgain--;
        }

        if (!Dead)
        {
            X++;
            CheckIfCrashed(world);
            CheckForBulletCollide(world);
            ShootBullets(world);
        }

        Animation.Update();
    }
Beispiel #13
0
 static void Main()
 {
     using (var game = new SkyKidGame())
             game.Run();
 }
Beispiel #14
0
 static void Main()
 {
     using (var game = new SkyKidGame())
         game.Run();
 }