Exemplo n.º 1
0
        private DuckHuntBall BuildDuck(CollisionData[] boundary)
        {
            DuckHuntBall duckball;
            AnimatedSprite dscduck = new AnimatedSprite();
            AnimatedSprite ascduck = new AnimatedSprite();

            int flapspeed = 4;

            dscduck.BuildAnimation(m_duck_txt, 1, 9, true, new int[20] { 3, 4, 5, 4, 3, 4, 5, 4, 3, 4, 5, 4, 3, 4, 5, 4, 3, 4, 5, 4 });
            dscduck.SetFrame(0, flapspeed, null);
            dscduck.SetFrame(1, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(2, flapspeed, null);
            dscduck.SetFrame(3, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(4, flapspeed, null);
            dscduck.SetFrame(5, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(6, flapspeed, null);
            dscduck.SetFrame(7, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(8, flapspeed, m_duckquack_snd);
            dscduck.SetFrame(9, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(10, flapspeed, null);
            dscduck.SetFrame(11, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(12, flapspeed, null);
            dscduck.SetFrame(13, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(14, flapspeed, null);
            dscduck.SetFrame(15, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(16, flapspeed, null);
            dscduck.SetFrame(17, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(18, flapspeed, null);
            dscduck.SetFrame(19, flapspeed, m_flapwing_snd);

            ascduck.BuildAnimation(m_duck_txt, 1, 9, true, new int[20] { 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1 });
            ascduck.SetFrame(0, flapspeed, null);
            ascduck.SetFrame(1, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(2, flapspeed, null);
            ascduck.SetFrame(3, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(4, flapspeed, null);
            ascduck.SetFrame(5, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(6, flapspeed, null);
            ascduck.SetFrame(7, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(8, flapspeed, m_duckquack_snd);
            ascduck.SetFrame(9, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(10, flapspeed, null);
            ascduck.SetFrame(11, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(12, flapspeed, null);
            ascduck.SetFrame(13, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(14, flapspeed, null);
            ascduck.SetFrame(15, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(16, flapspeed, null);
            ascduck.SetFrame(17, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(18, flapspeed, null);
            ascduck.SetFrame(19, flapspeed, m_flapwing_snd);

            duckball = new DuckHuntBall(HelperUtils.SafeBoundary.X + 512, HelperUtils.SafeBoundary.Y + 476, boundary);
            duckball.AddAnimation(dscduck);
            duckball.AddAnimation(ascduck);
            duckball.Ball_State = BallState.Limbo;

            return duckball;
        }
        public override void LoadContent()
        {
            if (m_content == null)
                m_content = new ContentManager(ScreenManager.Game.Services, "Content");

            m_duck_txt = m_content.Load<Texture2D>("DuckHunt\\Textures\\duck");
            m_menu_fnt = m_content.Load<SpriteFont>("Fonts\\bigfont");

            m_selector_snd = m_content.Load<SoundEffect>("DuckHunt\\Sounds\\select");

            m_resume = new MenuFontItem(ScreenManager.GraphicsDevice.Viewport.Width / 2 - (int)m_menu_fnt.MeasureString("RESUME").X/2, 150, "RESUME", m_menu_fnt);
            m_restart = new MenuFontItem(ScreenManager.GraphicsDevice.Viewport.Width / 2 - (int)m_menu_fnt.MeasureString("RESTART").X / 2, 155 + m_resume.Height, "RESTART", m_menu_fnt);
            m_quit = new MenuFontItem(ScreenManager.GraphicsDevice.Viewport.Width / 2 - (int)m_menu_fnt.MeasureString("QUIT").X / 2, 160 + 2*m_resume.Height, "QUIT",m_menu_fnt);

            m_selector = new AnimatedSprite();
            m_selector.BuildAnimation(m_duck_txt, 1, 9, true, new int[4] { 3, 4, 5, 4 });
            m_selector.SetFrame(0, 9, null);
            m_selector.SetFrame(1, 9, null);
            m_selector.SetFrame(2, 9, null);
            m_selector.SetFrame(3, 9, null);
            m_selector.X_Pos = m_resume.X_Pos - (int)(m_selector.Width*1.5);
            m_selector.Y_Pos = m_resume.Y_Pos + m_resume.Height / 2 - m_selector.Height / 2;

            // Hook up menu event handlers.
            m_resume.m_selected_events += OnCancel;
            m_restart.m_selected_events += RestartGameMenuEntrySelected;
            m_quit.m_selected_events += QuitGameMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(m_resume);
            MenuEntries.Add(m_restart);
            MenuEntries.Add(m_quit);

            m_selected = m_resume;
        }
Exemplo n.º 3
0
        public void Reset()
        {
            m_built1 = false;
            m_built2 = false;
            m_duck_count = 10;
            m_laughdog_anim = new AnimatedSprite();
            m_flyawayduck_anim_1 = new AnimatedSprite();  // Flyaway Duck inter 1
            m_flyawayduck_anim_2 = new AnimatedSprite();  // Flyaway Duck inter 2
            m_flyaway_scn = new AnimationScene();
            m_flyaway_scn_inter = new AnimationScene();
            m_dog_laugh_scn_inter = new AnimationScene();
            m_intermission1 = new AnimationManager();
            m_intermission2 = new AnimationManager();
            m_counter_spr = new Sprite();

            BuildAnimations();
            m_pongballs.Clear();
            m_pongballs.Add(BuildDuck(m_boundary));
            m_pongballs.Add(BuildDuck(m_boundary));
        }
Exemplo n.º 4
0
        private DuckHuntBall BuildDuck(CollisionData[] boundary)
        {
            DuckHuntBall   duckball;
            AnimatedSprite dscduck = new AnimatedSprite();
            AnimatedSprite ascduck = new AnimatedSprite();

            int flapspeed = 4;

            dscduck.BuildAnimation(m_duck_txt, 1, 9, true, new int[20] {
                3, 4, 5, 4, 3, 4, 5, 4, 3, 4, 5, 4, 3, 4, 5, 4, 3, 4, 5, 4
            });
            dscduck.SetFrame(0, flapspeed, null);
            dscduck.SetFrame(1, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(2, flapspeed, null);
            dscduck.SetFrame(3, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(4, flapspeed, null);
            dscduck.SetFrame(5, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(6, flapspeed, null);
            dscduck.SetFrame(7, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(8, flapspeed, m_duckquack_snd);
            dscduck.SetFrame(9, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(10, flapspeed, null);
            dscduck.SetFrame(11, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(12, flapspeed, null);
            dscduck.SetFrame(13, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(14, flapspeed, null);
            dscduck.SetFrame(15, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(16, flapspeed, null);
            dscduck.SetFrame(17, flapspeed, m_flapwing_snd);
            dscduck.SetFrame(18, flapspeed, null);
            dscduck.SetFrame(19, flapspeed, m_flapwing_snd);

            ascduck.BuildAnimation(m_duck_txt, 1, 9, true, new int[20] {
                0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1
            });
            ascduck.SetFrame(0, flapspeed, null);
            ascduck.SetFrame(1, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(2, flapspeed, null);
            ascduck.SetFrame(3, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(4, flapspeed, null);
            ascduck.SetFrame(5, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(6, flapspeed, null);
            ascduck.SetFrame(7, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(8, flapspeed, m_duckquack_snd);
            ascduck.SetFrame(9, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(10, flapspeed, null);
            ascduck.SetFrame(11, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(12, flapspeed, null);
            ascduck.SetFrame(13, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(14, flapspeed, null);
            ascduck.SetFrame(15, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(16, flapspeed, null);
            ascduck.SetFrame(17, flapspeed, m_flapwing_snd);
            ascduck.SetFrame(18, flapspeed, null);
            ascduck.SetFrame(19, flapspeed, m_flapwing_snd);

            duckball = new DuckHuntBall(HelperUtils.SafeBoundary.X + 512, HelperUtils.SafeBoundary.Y + 476, boundary);
            duckball.AddAnimation(dscduck);
            duckball.AddAnimation(ascduck);
            duckball.Ball_State = BallState.Limbo;

            return(duckball);
        }