Ejemplo n.º 1
0
 private void Shoot(Vector2 target, GameTime time)
 {
     shotCooldown -= time.ElapsedGameTime.TotalSeconds;
     if (shotCooldown < 0)
     {
         BulletsEverywhere.SpawnBullet(new Vector2((faces == facing.right) ? (collision.X + collision.Width + 10) : collision.X - 50, collision.Y + 10), (faces == facing.right), BulletsEverywhere.BulletType.regenbogen);
         shotCooldown = 0.5;
     }
 }
Ejemplo n.º 2
0
 private void Shoot(Vector2 target, GameTime time)
 {
     shotCooldown -= time.ElapsedGameTime.TotalSeconds;
     if (shotCooldown < 0)
     {
         Sound.sounds["Schlitzschlitz"].Play();
         BulletsEverywhere.SpawnBullet(new Vector2((faces == facing.right) ? (collision.X + collision.Width + 10) : collision.X - 50, collision.Y + 10), (faces == facing.right), BulletsEverywhere.BulletType.knife);
         shotCooldown += 1;
     }
 }
Ejemplo n.º 3
0
 private void Shoot(Vector2 target, GameTime time)
 {
     shotCooldown -= time.ElapsedGameTime.TotalSeconds;
     if (shotCooldown < 0)
     {
         Sound.sounds["Bösesschlitzschlitz"].Play();
         bool right = rand.NextDouble() < 0.5;
         BulletsEverywhere.SpawnBullet(target + new Vector2(right?-200:200, 0), right, BulletsEverywhere.BulletType.cthullu);
         shotCooldown = 5;
     }
 }
Ejemplo n.º 4
0
 private void Shoot(Vector2 target, GameTime time)
 {
     shotCooldown -= time.ElapsedGameTime.TotalSeconds;
     if (shotCooldown < 0)
     {
         Sound.sounds["Blob"].Play();
         BulletsEverywhere.SpawnBullet(sprite.Center.ToVector2() + new Vector2(0, verticalSpeed), true, BulletsEverywhere.BulletType.seifenblase);
         shotCooldown += 0.5;
     }
     else if (shotCooldown < 0)
     {
         shotCooldown = 0;
     }
 }
Ejemplo n.º 5
0
        public override void Update(GameTime time)
        {
            Revolvertexture.Update(time);
            Kanonetexture.Update(time);
            Seesterntexture.Update(time);

            if (Controls.GetKey(Controls.EKey.Up).HasJustBeenPressed() && jumpcount < 5)
            {
                isJumping        = true;
                currjumpduration = 0;
                currjumpheight   = 0;
                jumpcount       += 1;
            }
            if (Controls.GetKey(Controls.EKey.Down).IsPressed())
            {
                Position += new Vector2(0, 150f) * (float)time.ElapsedGameTime.TotalSeconds;
                isJumping = false;
            }

            if (Controls.GetKey(Controls.EKey.Left).IsPressed())
            {
                SetAnimations(1);
                Position += new Vector2(-150f, 0) * (float)time.ElapsedGameTime.TotalSeconds;
            }
            else if (Controls.GetKey(Controls.EKey.Right).IsPressed())
            {
                SetAnimations(1);
                Position += new Vector2(150f, 0) * (float)time.ElapsedGameTime.TotalSeconds;
            }
            else
            {
                SetAnimations(0);
            }


            if (Controls.GetKey(Controls.EKey.firstweapon).IsPressed())
            {
                currentweapon = weapon.revolver;
            }
            if (Controls.GetKey(Controls.EKey.secondweapon).IsPressed())
            {
                currentweapon = weapon.kanone;
            }
            if (Controls.GetKey(Controls.EKey.thirdweapon).IsPressed())
            {
                currentweapon = weapon.seestern;
            }

            shotCooldown -= time.ElapsedGameTime.TotalSeconds;
            if (shotCooldown < 0)
            {
                shotCooldown = -0.1;
            }

            if (Controls.GetKey(Controls.EKey.Shoot).IsPressed())
            {
                if (shotCooldown < 0)
                {
                    Sound.sounds["PewPew2"].Play();
                    switch (currentweapon)
                    {
                    case weapon.revolver:
                        //BulletsEverywhere.SpawnBullet(new Vector2((faces == facing.right) ? (collision.X + collision.Width + 30) : collision.X -30, collision.Y), (faces == facing.right), BulletsEverywhere.BulletType.cthullu);
                        BulletsEverywhere.SpawnBullet(new Vector2((faces == facing.right)?(collision.X + collision.Width + 30):collision.X - 40, collision.Y + 11), (faces == facing.right), BulletsEverywhere.BulletType.revolver);
                        shotCooldown += 0.5;
                        break;

                    case weapon.kanone:
                        BulletsEverywhere.SpawnBullet(new Vector2((faces == facing.right) ? (collision.X + collision.Width + 30) : collision.X - 40, collision.Y + 13), (faces == facing.right), BulletsEverywhere.BulletType.kanone);
                        shotCooldown += 1;
                        break;

                    case weapon.seestern:
                        BulletsEverywhere.SpawnBullet(new Vector2((faces == facing.right) ? (collision.X + collision.Width + 30) : collision.X - 40, collision.Y + 11), (faces == facing.right), BulletsEverywhere.BulletType.seestern);
                        shotCooldown += 0.6;
                        break;
                    }
                }
            }

            if (isJumping)
            {
                Jump(time);
            }
            else
            {
                //schwerkraft
                Position += new Vector2(0, 100f) * (float)time.ElapsedGameTime.TotalSeconds;
            }
        }