public override void TakeHit(Sonic hitter, GameLevel level, out bool blocking) { blocking = true; hitter.Coins++; active = false; MovingAnchoredAnimation maa = new MovingAnchoredAnimation(3.0f, new Point[] { new Point((int)this.Location.X, (int)this.Location.Y+48), new Point((int)this.Location.X, (int)this.Location.Y + 144) }, 16, 0, 3, 0, 48, 48, Coin.SpinCoin, true); (XSonicGame.CurrentGame.Services.GetService(typeof(AnimationManager)) as AnimationManager).Add(maa); (XSonicGame.CurrentGame.Services.GetService(typeof(AudioManager)) as AudioManager).PlaySound("coins"); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic hereC:\Users\klogan\Desktop\MTM312 Multimedia, Game and Entertainment Systems\Sonic the Plumber\XSonic\Drawing\MovingAnchoredAnimation.cs (Services.GetService(typeof(AnimationManager)) as AnimationManager).Clear(); levelList = LoadLevelList(); //bonusList = LoadLevelList();//LoadBonusLevelList(); currentLevelIndex = -1; currentBonusLevel = -1; player = new Characters.Sonic(); NextLevel(); (Services.GetService(typeof(AudioManager)) as AudioManager).LoadContent(Content); //load all of the songs and fx Coin.SpinCoin = (XSonicGame.CurrentGame.Services.GetService(typeof(AnimationManager)) as AnimationManager).Content.Load<Texture2D>("spincoin"); Animation coinCountAnimation = new Animation(new Point(10, 10), 8, 0, 3, 0, 48, 48, Coin.SpinCoin, true); (Services.GetService(typeof(AnimationManager)) as AnimationManager).Add(coinCountAnimation); base.Initialize(); }
public virtual void TakeHit(Sonic player, GameLevel level, out bool blocking) { blocking = true; return; }
public void Do(XSonicGame game, Sonic player, AudioManager audio, GameTime gameTime) { if (doing) { if (gameTime.TotalGameTime.TotalMilliseconds - doingAt >= 3000.0f && doingAt != -1.0f) { doing = false; doingAt = -1.0f; player.IsAlive = true; game.ResetLevel(); } else { //base.Update(gameTime); return; } } if (!player.IsAlive) { BloodSplatter bs = new BloodSplatter(player.Location, 5000, 30); if (player.HasBonus) { player.HasBonus = false; doingBonus = false; player.IsAlive = true; game.ResetAfterBonus(); } else if (!doing) { doing = true; Point[] deathAnimationPoints = XSonicGame.GetParabolic(player.Location.X, player.Location.Y, 17.25f, 0.8f, 17);//new Point[] { new Point((int)player.Location.X, (int)player.Location.Y), new Point((int)player.Location.X, (int)player.Location.Y + 144), new Point((int)player.Location.X - 96, (int)player.Location.Y + 96), new Point((int)player.Location.X - 96, (int)player.Location.Y - 96) }; MovingAnchoredAnimation maa = new MovingAnchoredAnimation(5.0f, deathAnimationPoints, 2, 3, 6, 6, 48, 48, player.SpriteSheet, false); (XSonicGame.CurrentGame.Services.GetService(typeof(AnimationManager)) as AnimationManager).Add(maa); player.Lives--; if (player.Lives >= 0) { audio.PlaySound("1down"); doingAt = gameTime.TotalGameTime.TotalMilliseconds; } else { audio.PlaySpecialSong("gameover"); } } } if (player.HasWon) { if(!game.OnLastLevel()) { doingBonus = false; player.HasBonus = false; game.NextLevel(); } } if (player.HasBonus && !doingBonus) { doingBonus = true; game.NextBonusLevel(); } }