public void Reset() { wdog.Reset(); sdog.Reset(); sprdog.Reset(); jdog1.Reset(); jdog2.Reset(); jdog3.Reset(); m_intro.ResetScene(); m_intro.Scene_State = DrawableState.Active; m_endround.Reset(); m_paused = false; m_played_intro = false; m_built_ending = false; 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]; m_ducks.Reset(); m_player1.LoadContent(m_player_textures, m_num, m_score_fnt, boxrec); m_player2.LoadContent(m_player_textures, m_num, m_score_fnt, boxrec); }
public void Reset() { wdog.Reset(); sdog.Reset(); sprdog.Reset(); jdog1.Reset(); jdog2.Reset(); jdog3.Reset(); m_intro.ResetScene(); m_intro.Scene_State = DrawableState.Active; m_endround.Reset(); m_paused = false; m_played_intro = false; m_built_ending = false; 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]; m_ducks.Reset(); m_player1.LoadContent(m_player_textures, m_num, m_score_fnt, boxrec); m_player2.LoadContent(m_player_textures, m_num, m_score_fnt, boxrec); }
/// <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(); }
/// <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(); }