Esempio n. 1
0
        private void BuildAnimations()
        {
            //              Counter Stuff
            int    x, y;
            Sprite temp;

            x = HelperUtils.SafeBoundary.X + 578;
            y = HelperUtils.SafeBoundary.Y + 566;

            // Create the ducks for the counter
            for (int i = 0; i < 10; i++)
            {
                temp             = new Sprite();
                temp.Texture     = m_duckcount_txt;
                temp.X_Pos       = x;
                temp.Y_Pos       = y;
                m_ducks[i]       = new Duck();
                m_ducks[i].m_spr = temp;
                x -= (m_duckcount_txt.Width + 2);
            }

            m_counter_spr.Texture = m_countbg_txt;
            m_counter_spr.X_Pos   = HelperUtils.SafeBoundary.X + 512 - (m_countbg_txt.Width / 2);
            m_counter_spr.Y_Pos   = HelperUtils.SafeBoundary.Y + 536;

            //            Intermission Stuff

            m_flyawayduck_anim_1.BuildAnimation(m_flyingaway_txt, 1, 3, true, new int[4] {
                0, 1, 2, 1
            });
            m_flyawayduck_anim_1.SetFrame(0, 4, null);
            m_flyawayduck_anim_1.SetFrame(1, 4, m_flapwing_snd);
            m_flyawayduck_anim_1.SetFrame(2, 4, null);
            m_flyawayduck_anim_1.SetFrame(3, 4, m_flapwing_snd);

            m_flyawayduck_anim_2.BuildAnimation(m_flyingaway_txt, 1, 3, true, new int[4] {
                0, 1, 2, 1
            });
            m_flyawayduck_anim_2.SetFrame(0, 4, null);
            m_flyawayduck_anim_2.SetFrame(1, 4, m_flapwing_snd);
            m_flyawayduck_anim_2.SetFrame(2, 4, null);
            m_flyawayduck_anim_2.SetFrame(3, 4, m_flapwing_snd);

            m_laughdog_anim.BuildAnimation(m_laughingdog_txt, 1, 2, true, new int[2] {
                0, 1
            });
            m_laughdog_anim.SetFrame(0, 6, null);
            m_laughdog_anim.SetFrame(1, 6, null);

            m_dog_laugh_scn_inter.AddAnimation(new DirXYMover(m_laughdog_anim, 0, -47, 1.4f), m_doglaugh_snd);
            m_dog_laugh_scn_inter.AddAnimation(new TimeOutDrawable(m_laughdog_anim, 60, true));
            m_dog_laugh_scn_inter.AddAnimation(new DirXYMover(m_laughdog_anim, 0, 47, 1.6f));
        }
Esempio n. 2
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            /*  LOAD TEXTURES, SOUNDS AND FONTS */

            tree   = content.Load <Texture2D>("DuckHunt\\Textures\\tree");
            ground = content.Load <Texture2D>("DuckHunt\\Textures\\ground");
            bush   = content.Load <Texture2D>("DuckHunt\\Textures\\bush");
            m_player_textures[0] = content.Load <Texture2D>("DuckHunt\\Textures\\panel");
            walkingdog           = content.Load <Texture2D>("DuckHunt\\Textures\\walkdog");
            flyawaysign          = content.Load <Texture2D>("DuckHunt\\Textures\\flyawaysign");
            m_player_textures[1] = content.Load <Texture2D>("DuckHunt\\Textures\\score");
            m_player_textures[2] = content.Load <Texture2D>("DuckHunt\\Textures\\clouds");
            m_player_textures[3] = content.Load <Texture2D>("DuckHunt\\Textures\\duckcall");
            m_player_textures[4] = content.Load <Texture2D>("DuckHunt\\Textures\\shot");
            clouds[0]            = content.Load <Texture2D>("DuckHunt\\Textures\\smallcloud");
            clouds[1]            = content.Load <Texture2D>("DuckHunt\\Textures\\medcloud");
            clouds[2]            = content.Load <Texture2D>("DuckHunt\\Textures\\bigcloud");

            dogbark    = content.Load <SoundEffect>("DuckHunt\\Sounds\\dogbark");
            m_shot     = content.Load <SoundEffect>("DuckHunt\\Sounds\\shot");
            startround = content.Load <SoundEffect>("DuckHunt\\Sounds\\startround");
            endround   = content.Load <SoundEffect>("DuckHunt\\Sounds\\roundend");
            pause      = content.Load <SoundEffect>("DuckHunt\\Sounds\\pause");

            m_num       = content.Load <SpriteFont>("Fonts\\bignesfont");
            m_score_fnt = content.Load <SpriteFont>("Fonts\\hugenesfont");

            debug = new Texture2D(ScreenManager.GraphicsDevice, 1, 1);
            debug.SetData(new Color[] { new Color(255, 255, 255) });

            m_clouds_p1 = new Clouds(0, clouds); //, debug);
            m_clouds_p2 = new Clouds(1, clouds); //, debug);
            m_clouds    = new Cloud[m_clouds_p1.CloudsA.Length * 2];

            m_clouds[0]  = m_clouds_p1.CloudsA[0];
            m_clouds[1]  = m_clouds_p1.CloudsA[1];
            m_clouds[2]  = m_clouds_p1.CloudsA[2];
            m_clouds[3]  = m_clouds_p1.CloudsA[0];
            m_clouds[4]  = m_clouds_p1.CloudsA[1];
            m_clouds[5]  = m_clouds_p1.CloudsA[2];
            m_clouds[6]  = m_clouds_p2.CloudsA[0];
            m_clouds[7]  = m_clouds_p2.CloudsA[1];
            m_clouds[8]  = m_clouds_p2.CloudsA[2];
            m_clouds[9]  = m_clouds_p2.CloudsA[0];
            m_clouds[10] = m_clouds_p2.CloudsA[1];
            m_clouds[11] = m_clouds_p2.CloudsA[2];

            /* SETUP ALL ANIMATIONSPRITES */
            wdog.BuildAnimation(walkingdog, 1, 8, true, new int[4] {
                1, 2, 3, 4
            });
            wdog.SetFrame(0, 8, null);
            wdog.SetFrame(1, 8, null);
            wdog.SetFrame(2, 8, null);
            wdog.SetFrame(3, 8, null);
            wdog.X_Pos = HelperUtils.SafeBoundary.X + 22;
            wdog.Y_Pos = HelperUtils.SafeBoundary.Y + 471;

            sdog.BuildAnimation(walkingdog, 1, 8, true, new int[6] {
                1, 0, 1, 0, 1, 0
            });
            sdog.SetFrame(0, 8, null);
            sdog.SetFrame(1, 8, null);
            sdog.SetFrame(2, 8, null);
            sdog.SetFrame(3, 8, null);
            sdog.SetFrame(4, 8, null);
            sdog.SetFrame(5, 8, null);

            sprdog.BuildAnimation(walkingdog, 1, 8, true, new int[1] {
                5
            });
            sprdog.SetFrame(0, 100, null);

            jdog1.BuildAnimation(walkingdog, 1, 8, true, new int[1] {
                6
            });
            jdog1.SetFrame(0, 1000, dogbark);

            jdog2.BuildAnimation(walkingdog, 1, 8, true, new int[1] {
                6
            });
            jdog2.SetFrame(0, 50, dogbark);

            jdog3.BuildAnimation(walkingdog, 1, 8, true, new int[1] {
                7
            });
            jdog3.SetFrame(0, 50, dogbark);

            /*   MAKE INTRO ANIMATION   */
            m_intro.AddAnimation(new DirXYMover(wdog, 180, 0, 1.7f));
            m_intro.AddAnimation(new TimeOutDrawable(sdog, 49, true));
            m_intro.AddAnimation(new DirXYMover(wdog, 180, 0, 1.7f));
            m_intro.AddAnimation(new TimeOutDrawable(sdog, 49, true));
            m_intro.AddAnimation(new DirXYMover(wdog, 10, 0, 1.7f));
            m_intro.AddAnimation(new TimeOutDrawable(sprdog, 49, true));
            m_intro.AddAnimation(new DirXYMover(jdog1, 5, -50, 3.5f));
            m_intro.AddAnimation(new DirXYMover(jdog1, 15, -25, 3.0f));
            m_intro.AddAnimation(new DirXYMover(jdog2, 15, -25, 3.0f));
            m_intro.AddAnimation(new DirXYMover(jdog3, 40, 40, 3.0f));
            m_intro.BuildScene(new int[10] {
                0, 1, 2, 3, 4, 5, 6, 7, 8, 9
            });
            m_intro.Scene_State = DrawableState.Active;

            /* Make a texture for bg. NOT gonna be needed when I change the dimension of screen */
            ScreenTexture = new Texture2D(ScreenManager.GraphicsDevice, 1, 1);
            ScreenTexture.SetData(new Color[] { Color.White });

            /* Build the SHOT animations */
            flash = new Texture2D(ScreenManager.GraphicsDevice, 1, 1);
            flash.SetData(new Color[] { new Color(255, 255, 255, 128) });

            m_flash            = new TimeOutDrawable(new Image(HelperUtils.SafeBoundary.X, HelperUtils.SafeBoundary.Y, 1024, 612, flash), 3, false);
            m_flash.Draw_State = DrawableState.Finished;

            /* Create Players */
            m_player1 = new DuckHuntPlayer(0);
            m_player1.LoadContent(m_player_textures, m_num, m_score_fnt, boxrec);
            m_player2 = new DuckHuntPlayer(1);
            m_player2.LoadContent(m_player_textures, m_num, m_score_fnt, boxrec);

            newbound  = Boundary.CreateBoundRects(boxrec);
            bounddata = new CollisionData[newbound.Length];

            bounddata[0] = new CollisionData(newbound[0]);
            bounddata[1] = new CollisionData(newbound[1]);
            bounddata[2] = new CollisionData(newbound[2]);
            bounddata[3] = new CollisionData(newbound[3]);
            bounddata[4] = new CollisionData(newbound[4]);
            bounddata[5] = new CollisionData(newbound[5]);
            bounddata[6] = new CollisionData(newbound[6]);
            bounddata[7] = new CollisionData(newbound[7]);
            bounddata[8] = new CollisionData(newbound[8]);
            bounddata[9] = new CollisionData(newbound[9]);

            m_ducks = new DuckPopulation(content, bounddata);

            // FLY AWAY SIGN
            m_fly_sign.Texture = flyawaysign;
            m_fly_sign.X_Pos   = ScreenManager.GraphicsDevice.Viewport.Width / 2 - m_fly_sign.Texture.Width / 2;
            m_fly_sign.Y_Pos   = HelperUtils.SafeBoundary.Y + 256;

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            Thread.Sleep(1000);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }
Esempio n. 3
0
        public void BuildIntermission()
        {
            // Build intermission
            if (!m_built1 && ((m_pongballs[0].Ball_State == BallState.Active || m_pongballs[0].Ball_State == BallState.OutofBounds) &&
                              m_pongballs[1].Ball_State == BallState.DeadBall) ||
                (m_pongballs[1].Ball_State == BallState.Active || m_pongballs[1].Ball_State == BallState.OutofBounds) &&
                m_pongballs[0].Ball_State == BallState.DeadBall)
            {
                // Make intermission with flyaway
                if (m_pongballs[0].Ball_State == BallState.DeadBall)
                {
                    m_pongballs[0].Ball_State  = BallState.Limbo;
                    m_flyawayduck_anim_1.X_Pos = m_pongballs[0].X_Pos;
                    m_flyawayduck_anim_1.Y_Pos = m_pongballs[0].Y_Pos;

                    m_flyaway_scn.Clear();
                    m_flyaway_scn.AddAnimation(new DirXYMover(m_flyawayduck_anim_1, 0, -(m_pongballs[0].Y_Pos + m_flyawayduck_anim_1.Height), 4.5f)); //m_pongBall.Curr_Vel_Mag));
                }
                else
                {
                    m_pongballs[1].Ball_State  = BallState.Limbo;
                    m_flyawayduck_anim_1.X_Pos = m_pongballs[1].X_Pos;
                    m_flyawayduck_anim_1.Y_Pos = m_pongballs[1].Y_Pos;

                    m_flyaway_scn.Clear();
                    m_flyaway_scn.AddAnimation(new DirXYMover(m_flyawayduck_anim_1, 0, -(m_pongballs[1].Y_Pos + m_flyawayduck_anim_1.Height), 4.5f)); //m_pongBall.Curr_Vel_Mag));
                }

                m_flyaway_scn.BuildScene(new int[1] {
                    0
                });
                m_flyaway_scn.Scene_State = DrawableState.Active;

                m_intermission1.AddScene(m_flyaway_scn);
                m_intermission1.Build(new int[1] {
                    0
                });
                m_intermission1.Manager_State = DrawableState.Active;

                // DeadBall is now in limbo mode
                m_built1 = true;
            }
            else if (!m_built2 && ((m_pongballs[0].Ball_State == BallState.DeadBall &&
                                    (m_pongballs[1].Ball_State == BallState.OutofBounds || m_pongballs[1].Ball_State == BallState.Limbo)) ||
                                   (m_pongballs[1].Ball_State == BallState.DeadBall &&
                                    (m_pongballs[0].Ball_State == BallState.OutofBounds || m_pongballs[0].Ball_State == BallState.Limbo))))
            {
                // Make intermission with flyaway duck and laughing dog
                if (m_pongballs[0].Ball_State == BallState.DeadBall)
                {
                    m_pongballs[0].Ball_State  = BallState.Limbo;
                    m_flyawayduck_anim_2.X_Pos = m_pongballs[0].X_Pos;
                    m_flyawayduck_anim_2.Y_Pos = m_pongballs[0].Y_Pos;

                    m_flyaway_scn_inter.Clear();
                    m_flyaway_scn_inter.AddAnimation(new DirXYMover(m_flyawayduck_anim_2, 0, -(m_pongballs[0].Y_Pos + m_flyawayduck_anim_2.Height), 4.5f)); //m_pongBall.Curr_Vel_Mag));
                }
                else
                {
                    m_pongballs[1].Ball_State  = BallState.Limbo;
                    m_flyawayduck_anim_2.X_Pos = m_pongballs[1].X_Pos;
                    m_flyawayduck_anim_2.Y_Pos = m_pongballs[1].Y_Pos;

                    m_flyaway_scn_inter.Clear();
                    m_flyaway_scn_inter.AddAnimation(new DirXYMover(m_flyawayduck_anim_2, 0, -(m_pongballs[1].Y_Pos + m_flyawayduck_anim_2.Height), 4.5f)); //m_pongBall.Curr_Vel_Mag));
                }

                /* Flyaway Duck */
                m_flyaway_scn_inter.BuildScene(new int[1] {
                    0
                });
                m_flyaway_scn_inter.Scene_State = DrawableState.Active;

                /* Laughing Dog */
                m_laughdog_anim.X_Pos = HelperUtils.SafeBoundary.X + 512 - m_laughdog_anim.Width / 2;
                m_laughdog_anim.Y_Pos = HelperUtils.SafeBoundary.Y + 466;
                m_dog_laugh_scn_inter.BuildScene(new int[3] {
                    0, 1, 2
                });
                m_dog_laugh_scn_inter.Scene_State = DrawableState.Active;

                /* Intermission */
                m_intermission2.AddScene(m_flyaway_scn_inter);
                m_intermission2.AddScene(m_dog_laugh_scn_inter);
                m_intermission2.Build(new int[2] {
                    0, 1
                });
                m_intermission2.Manager_State = DrawableState.Active;

                m_built2 = true;
            }
        }