コード例 #1
0
        public ShooterLevel(EventHandler callback)
            : base(callback)
        {
            if (!contentLoaded)
            {
                shooterMusic     = Content.Load <Song>("shootermusic");
                pauseFont        = Content.Load <SpriteFont>("Battle1BillStatusFont");
                crossHairTexture = Content.Load <Texture2D>("crosshair");
                gunTexture       = Content.Load <Texture2D>("bluecrystal");
                gunBoardTexture  = Content.Load <Texture2D>("wood");
                gunWheelTexture  = Content.Load <Texture2D>("woodwheel2");
                blastTexture     = Content.Load <Texture2D>("explosionsmall");
                contentLoaded    = true;
            }

            Game1.Game.IsMouseVisible = false;

            gun           = new CrystalGun(new Rectangle(0, 0, GUNWIDTH, GUNHEIGHT), new Rectangle(0, 0, 60, 5), GUNWHEELSIZE, gunTexture, gunBoardTexture, gunWheelTexture);
            gun.Position  = gun.PrecisePosition = new Vector2(Graphics.GraphicsDevice.Viewport.Width / 2, Graphics.GraphicsDevice.Viewport.Height - GUNWHEELSIZE / 2);
            gun.MoveSpeed = 50;
            gun.TurnSpeed = 3;
            gun.Texture   = gunTexture;

            gun.ShootDelay  = 175;
            gun.BulletSize  = 8;
            gun.BulletSpeed = 800;

            /*gunBoard = new BaseObject(new Rectangle(0, 0, 60, 5));
             * gunBoard.CenterPoint = gun.Position;
             * gunBoard.Texture = gunBoardTexture;*/

            /*gunWheel1 = new BaseObject(new Rectangle(0, 0, GUNWHEELSIZE, GUNWHEELSIZE));
             * gunWheel1.PrecisePosition = gunBoard.CenterPoint - new Vector2(26, 0);
             *
             * gunWheel2 = new BaseObject(new Rectangle(0, 0, GUNWHEELSIZE, GUNWHEELSIZE));
             * gunWheel2.PrecisePosition = gunBoard.CenterPoint + new Vector2(26, 0);
             *
             * gunWheel1.Texture = gunWheel2.Texture = gunWheelTexture;*/

            MediaPlayer.Play(shooterMusic);
            MediaPlayer.Volume      = .5f;
            MediaPlayer.IsRepeating = true;
        }
コード例 #2
0
ファイル: ShooterLevel.cs プロジェクト: nubington/bill
        public ShooterLevel(EventHandler callback)
            : base(callback)
        {
            if (!contentLoaded)
            {
                shooterMusic = Content.Load<Song>("shootermusic");
                pauseFont = Content.Load<SpriteFont>("Battle1BillStatusFont");
                crossHairTexture = Content.Load<Texture2D>("crosshair");
                gunTexture = Content.Load<Texture2D>("bluecrystal");
                gunBoardTexture = Content.Load<Texture2D>("wood");
                gunWheelTexture = Content.Load<Texture2D>("woodwheel2");
                blastTexture = Content.Load<Texture2D>("explosionsmall");
                contentLoaded = true;
            }

            Game1.Game.IsMouseVisible = false;

            gun = new CrystalGun(new Rectangle(0, 0, GUNWIDTH, GUNHEIGHT), new Rectangle(0, 0, 60, 5), GUNWHEELSIZE, gunTexture, gunBoardTexture, gunWheelTexture);
            gun.Position = gun.PrecisePosition = new Vector2(Graphics.GraphicsDevice.Viewport.Width / 2, Graphics.GraphicsDevice.Viewport.Height - GUNWHEELSIZE / 2);
            gun.MoveSpeed = 50;
            gun.TurnSpeed = 3;
            gun.Texture = gunTexture;

            gun.ShootDelay = 175;
            gun.BulletSize = 8;
            gun.BulletSpeed = 800;

            /*gunBoard = new BaseObject(new Rectangle(0, 0, 60, 5));
            gunBoard.CenterPoint = gun.Position;
            gunBoard.Texture = gunBoardTexture;*/

            /*gunWheel1 = new BaseObject(new Rectangle(0, 0, GUNWHEELSIZE, GUNWHEELSIZE));
            gunWheel1.PrecisePosition = gunBoard.CenterPoint - new Vector2(26, 0);

            gunWheel2 = new BaseObject(new Rectangle(0, 0, GUNWHEELSIZE, GUNWHEELSIZE));
            gunWheel2.PrecisePosition = gunBoard.CenterPoint + new Vector2(26, 0);

            gunWheel1.Texture = gunWheel2.Texture = gunWheelTexture;*/

            MediaPlayer.Play(shooterMusic);
            MediaPlayer.Volume = .5f;
            MediaPlayer.IsRepeating = true;
        }