public override void Draw(SpriteBatch spriteBatch) { if (!this.ShouldUpdate) { spriteBatch.Begin(samplerState: SamplerState.PointClamp); ISprite background = BackgroundFactory.GetInstance().CreateProduct(BackgroundTypes.BlackBackground); background.Draw(spriteBatch, new Color(100, 100, 100, 175), Point.Zero); int x = (VirtualWidth - pausedTexture.Width) / 2; int y = (VirtualHeight - pausedTexture.Height) / 5; spriteBatch.Draw(pausedTexture, new Rectangle(x, y, pausedTexture.Width, pausedTexture.Height), Color.White); Texture2D staticMario = ((Sprite) FireMarioFactory.GetInstance().CreateProduct(MarioTypes.IdleRight)).GetTexture(); spriteBatch.Draw(staticMario, new Vector2((float)((VirtualWidth - 96) * 0.5), (float)((VirtualHeight - 200) * 0.6)), new Rectangle(new Point(384, 161), new Point(47, 80)), Color.White, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0f); SpriteFont font = this.Game.Content.Load<SpriteFont>("Font/Mario Game HUD Text"); string name = CostumeChanger.GetInstance().CurrentName(); Texture2D leftButton = Game.Content.Load<Texture2D>("Textures/Left"); Texture2D rightButton = Game.Content.Load<Texture2D>("Textures/Right"); spriteBatch.Draw(leftButton, new Vector2(125, 250), Color.White); spriteBatch.Draw(rightButton, new Vector2(325, 250), Color.White); Vector2 strSize = font.MeasureString(name); int strWidth = (int) Math.Round(strSize.X); int strHeight = (int)Math.Round(strSize.Y); Vector2 position = new Vector2 { X = ((float)(VirtualWidth - strWidth) / 2), Y = ((float)(VirtualHeight - strHeight) / 2) + 125 }; spriteBatch.DrawString(font, string.Format(name), position, Color.White); spriteBatch.End(); } }
public static GameObject CheckCharacters(Entity entity) { switch (entity.Type) { case "Player": GameObject mario = Mario.GetInstance(); ((Mario)mario).CheckpointPosition = entity.CheckpointX; if (((Mario)mario).Checkpoint) { mario.PositionInGame = new Point(entity.CheckpointX, entity.CheckpointY); } else { mario.PositionInGame = new Point(entity.X, entity.Y); } CostumeChanger.GetInstance().Setup(); return(mario); case "Goomba": return(new Goomba(EnemyFactory.GetInstance(), new Point(entity.X, entity.Y))); case "GreenKoopa": return(new Koopa(EnemyFactory.GetInstance(), new Point(entity.X, entity.Y), false)); case "RedKoopa": return(new Koopa(EnemyFactory.GetInstance(), new Point(entity.X, entity.Y), true)); case "PiranhaPlant": return(new PiranhaPlant(EnemyFactory.GetInstance(), new Point(entity.X, entity.Y))); case "Bowser": return(new Bowser(BossFactory.GetInstance(), new Point(entity.X, entity.Y))); default: return(null); } }
public PreviousCostumeCommand(CostumeChanger costume) : base(costume) { }
public NextCostumeCommand(CostumeChanger costume) : base(costume) { }
public override void SetupControls() { #region Set Controls // Create new controllers and assign game exit commands this.keyboardPresses.Add(Keys.Q, new ExitCommand(Game)); this.keyboardPresses.Add(Keys.P, new PauseCommand(this)); this.keyboardPresses.Add(Keys.M, new MuteCommand(MusicPlayer.GetInstance(), Sounds.SoundPlayer.GetInstance())); this.keyboardPresses.Add(Keys.C, new ToggleDrawHitboxesCommand(Game)); this.keyboardPresses.Add(Keys.OemTilde, new ResetLevelCommand(Game)); this.pausedKeyboardPresses.Add(Keys.Q, new ExitCommand(Game)); this.pausedKeyboardPresses.Add(Keys.M, new MuteCommand(MusicPlayer.GetInstance(), Sounds.SoundPlayer.GetInstance())); this.pausedKeyboardPresses.Add(Keys.P, new PauseCommand(this)); this.pausedKeyboardPresses.Add(Keys.F, new ToggleFullscreenCommand(Game)); this.keyboardPresses.Add(Keys.Space, new JumpCommand(Mario.GetInstance())); this.keyboardPresses.Add(Keys.W, new JumpCommand(Mario.GetInstance())); this.keyboardHolds.Add(Keys.S, new CrouchCommand(Mario.GetInstance())); this.keyboardHolds.Add(Keys.A, new WalkLeftCommand(Mario.GetInstance())); this.keyboardHolds.Add(Keys.D, new WalkRightCommand(Mario.GetInstance())); this.keyboardPresses.Add(Keys.E, new CubeCommand()); this.keyboardPresses.Add(Keys.F, new SpitFireBall(Mario.GetInstance())); this.keyboardPresses.Add(Keys.R, new SwingSword(Mario.GetInstance())); this.keyboardPresses.Add(Keys.G, new GetInvincibility(Mario.GetInstance())); this.pausedKeyboardPresses.Add(Keys.A, new PreviousCostumeCommand(CostumeChanger.GetInstance())); this.pausedKeyboardPresses.Add(Keys.D, new NextCostumeCommand(CostumeChanger.GetInstance())); this.keyboardPresses.Add(Keys.Up, new JumpCommand(Mario.GetInstance())); this.keyboardHolds.Add(Keys.Down, new CrouchCommand(Mario.GetInstance())); this.keyboardHolds.Add(Keys.Left, new WalkLeftCommand(Mario.GetInstance())); this.keyboardHolds.Add(Keys.Right, new WalkRightCommand(Mario.GetInstance())); this.pausedKeyboardPresses.Add(Keys.Right, new NextCostumeCommand(CostumeChanger.GetInstance())); this.pausedKeyboardPresses.Add(Keys.Left, new PreviousCostumeCommand(CostumeChanger.GetInstance())); this.gamepadPresses.Add(Buttons.Start, new ExitCommand(Game)); this.gamepadPresses.Add(Buttons.RightShoulder, new PauseCommand(this)); this.gamepadPresses.Add(Buttons.LeftShoulder, new MuteCommand(MusicPlayer.GetInstance(), Sounds.SoundPlayer.GetInstance())); this.pausedGamepadPresses.Add(Buttons.Start, new ExitCommand(Game)); this.pausedGamepadPresses.Add(Buttons.RightShoulder, new PauseCommand(this)); this.pausedGamepadPresses.Add(Buttons.LeftShoulder, new MuteCommand(MusicPlayer.GetInstance(), Sounds.SoundPlayer.GetInstance())); this.pausedGamepadPresses.Add(Buttons.DPadLeft, new NextCostumeCommand(CostumeChanger.GetInstance())); this.pausedGamepadPresses.Add(Buttons.DPadRight, new PreviousCostumeCommand(CostumeChanger.GetInstance())); this.gamepadPresses.Add(Buttons.DPadUp, new JumpCommand(Mario.GetInstance())); this.gamepadHolds.Add(Buttons.DPadDown, new CrouchCommand(Mario.GetInstance())); this.gamepadHolds.Add(Buttons.DPadLeft, new WalkLeftCommand(Mario.GetInstance())); this.gamepadHolds.Add(Buttons.DPadRight, new WalkRightCommand(Mario.GetInstance())); this.gamepadPresses.Add(Buttons.A, new SpitFireBall(Mario.GetInstance())); //Cheat Codes this.keyboardPresses.Add(Keys.Y, new GoToSmallMarioCommand(Mario.GetInstance())); this.keyboardPresses.Add(Keys.U, new GoToSuperMarioCommand(Mario.GetInstance())); this.keyboardPresses.Add(Keys.I, new GoToFireMarioCommand(Mario.GetInstance())); this.keyboardPresses.Add(Keys.O, new DamageMarioCommand(Mario.GetInstance())); this.keyboardPresses.Add(Keys.D8, new WinCommand(this)); this.keyboardPresses.Add(Keys.D9, new GameOverCommand(this)); #endregion PreSetup(); }