예제 #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
예제 #2
0
        public KeyboardController(Game1 game, Mario mario)
        {
            time = 0;
            timeSinceToggle = 0;
            oldState = Keyboard.GetState(PlayerIndex.One);
            //action state keys
            keyBoardCommands.Add((int)Keys.Up, new UpCommand(mario));
            keyBoardCommands.Add((int)Keys.W, new UpCommand(mario));
            keyBoardCommands.Add((int)Keys.Down, new DownCommand(mario));
            keyBoardCommands.Add((int)Keys.S, new DownCommand(mario));
            keyBoardCommands.Add((int)Keys.Left, new LeftCommand(mario));
            keyBoardCommands.Add((int)Keys.A, new LeftCommand(mario));
            keyBoardCommands.Add((int)Keys.Right, new RightCommand(mario));
            keyBoardCommands.Add((int)Keys.D, new RightCommand(mario));
            keyBoardCommands.Add((int)Keys.Up & (int)Keys.Left, new UpLeftCommand(mario));
            keyBoardCommands.Add((int)Keys.Space, new FireballCommand(mario));
            keyBoardCommands.Add((int)Keys.F, new PlaceBlockCommand(game.Scene));
            keyBoardCommands.Add((int)Keys.H, new DestroyBlockCommand(game.Scene));

            //power up state keys
            keyBoardCommands.Add((int)Keys.Y, new StandardCommand(mario));
            keyBoardCommands.Add((int)Keys.U, new SuperCommand(mario));
            keyBoardCommands.Add((int)Keys.I, new FireCommand(mario));
            keyBoardCommands.Add((int)Keys.O, new DeadCommand(mario));
            //Game commands
            keyBoardCommands.Add((int)Keys.R, new ResetCommand(game));
            keyBoardCommands.Add((int)Keys.P, new PauseCommand(game));
            keyBoardCommands.Add((int)Keys.Q, new QuitCommand(game));
            keyBoardCommands.Add((int)Keys.M, new MuteCommand(game));
            keyBoardCommands.Add((int)Keys.V, new VictoryCommand(game));
            keyBoardCommands.Add((int)Keys.G, new GameoverCommand(game));
        }
예제 #3
0
 public MarioFactory(Game1 game)
 {
     this.position.X = 0;
     this.position.Y = game.GraphicsDevice.Viewport.Height;
     this.texture = game.Content.Load<Texture2D>("mario_2");
     sprites = new Dictionary<int,ISprite>();
 }
예제 #4
0
        public Mario(Game1 game, Scene scene)
        {
            MarioFactory = new MarioFactory(game);
            currentSprite = (MarioSprite)MarioFactory.MakeProduct(1);
            powerupStateFactor = 0;
            actionStateFactor = 1;
            direction = 1;
            idle = new MarioIdleState(this);
            jump = new MarioJumpingState(this);
            walk = new MarioWalkingState(this);
            crouch = new MarioCrouchingState(this);
            fall = new MarioFallingState(this);
            standard = new MarioStandard(this);
            super = new MarioSuper(this);
            fire = new MarioFire(this);
            dead = new MarioDead(this);
            powerupState = standard;
            currentState = idle;
            previousState = currentState;
            previousSprite = currentSprite;
            this.game = game;
            this.scene = scene;
            gravity = scene.Gravity;

            isGrounded = false;

            points = 0;
            coins = 10;
            lives = 3;
            sounds = new SoundMachine(game);
        }
예제 #5
0
파일: Mario.cs 프로젝트: bergerad/Test
        public Mario(Game1 game, int posX, int posY)
        {
            MarioFactory = new MarioFactory(game);
            currentSprite = (MarioSprite)MarioFactory.MakeProduct(1);
            powerupStateFactor = 0;
            actionStateFactor = 1;
            direction = 1;
            idle = new MarioIdleState(this);
            jump = new MarioJumpingState(this);
            walk = new MarioWalkingState(this);
            crouch = new MarioCrouchingState(this);
            fall = new MarioFallingState(this);
            standard = new MarioStandard(this);
            super = new MarioSuper(this);
            fire = new MarioFire(this);
            dead = new MarioDead(this);

            powerupState = standard;
            currentState = idle;
            previousState = currentState;
            previousSprite = currentSprite;

            marioVec.X = posX;
            marioVec.Y = posY;
        }
예제 #6
0
 public LevelManager(Game1 game)
 {
     this.game = game;
     texture = game.Content.Load<Texture2D>("LevelManager");
     oldState = Keyboard.GetState();
     font = game.Content.Load<SpriteFont>("LevelFonts");
     choose = false;
 }
예제 #7
0
 public Parser(Game1 game)
 {
     this.game = game;
     blockFactory = new BlockFactory(game);
     itemFactory = new ItemFactory(game);
     enemyFactory = new EnemyFactory(game);
     latestCheckpoint = new List<Vector2>();
 }
예제 #8
0
        public GamePadController(Game1 game, Mario mario)
        {
            oldState = GamePad.GetState(PlayerIndex.One);

                GamepadCommands.Add((int)Buttons.DPadUp, new UpCommand(mario));
                GamepadCommands.Add((int)Buttons.DPadDown, new DownCommand(mario));
                GamepadCommands.Add((int)Buttons.DPadLeft, new LeftCommand(mario));
                GamepadCommands.Add((int)Buttons.DPadRight, new RightCommand(mario));
                GamepadCommands.Add((int)Buttons.B, new FireballCommand(mario));

                GamepadCommands.Add((int)Buttons.Start, new PauseCommand(game));
        }
예제 #9
0
        public SoundMachine(Game1 game)
        {
            soundFX = new Dictionary<String, SoundEffect>();
            soundFX.Add("small-jump", game.Content.Load<SoundEffect>("jump-small"));
            soundFX.Add("big-jump", game.Content.Load<SoundEffect>("jump-super"));
            soundFX.Add("die", game.Content.Load<SoundEffect>("mariodie"));
            soundFX.Add("powerup", game.Content.Load<SoundEffect>("powerup"));
            soundFX.Add("stomp", game.Content.Load<SoundEffect>("stomp"));

            soundFX.Add("oneup", game.Content.Load<SoundEffect>("1-up"));
            soundFX.Add("bump", game.Content.Load<SoundEffect>("bump"));
            soundFX.Add("coin", game.Content.Load<SoundEffect>("coin"));
            soundFX.Add("powerdown", game.Content.Load<SoundEffect>("pipe"));
            soundFX.Add("gameover", game.Content.Load<SoundEffect>("GameOverSound"));

            soundFX.Add("warning", game.Content.Load<SoundEffect>("warning"));
            soundFX.Add("bricksmash", game.Content.Load<SoundEffect>("breakblock"));
            soundFX.Add("pause", game.Content.Load<SoundEffect>("pause"));
            soundFX.Add("winner", game.Content.Load<SoundEffect>("stage_clear"));
        }
예제 #10
0
        public KeyboardController(Game1 game, Mario mario)
        {
            oldState = Keyboard.GetState(PlayerIndex.One);
            //action state keys
            keyBoardCommands.Add((int)Keys.Up, new UpCommand(mario));
            keyBoardCommands.Add((int)Keys.W, new UpCommand(mario));
            keyBoardCommands.Add((int)Keys.Down, new DownCommand(mario));
            keyBoardCommands.Add((int)Keys.S, new DownCommand(mario));
            keyBoardCommands.Add((int)Keys.Left, new LeftCommand(mario));
            keyBoardCommands.Add((int)Keys.A, new LeftCommand(mario));
            keyBoardCommands.Add((int)Keys.Right, new RightCommand(mario));
            keyBoardCommands.Add((int)Keys.D, new RightCommand(mario));
            keyBoardCommands.Add((int)Keys.Space, new FireballCommand(mario));

            //power up state keys
            keyBoardCommands.Add((int)Keys.Y, new StandardCommand(mario));
            keyBoardCommands.Add((int)Keys.U, new SuperCommand(mario));
            keyBoardCommands.Add((int)Keys.I, new FireCommand(mario));
            keyBoardCommands.Add((int)Keys.O, new DeadCommand(mario));
            //block keys
            //reset command
            keyBoardCommands.Add((int)Keys.R, new ResetCommand(game));
            keyBoardCommands.Add((int)Keys.P, new PauseCommand(game));
        }
예제 #11
0
 public Block(Game1 game, int posX, int posY)
 {
     BlockFactory = new BlockFactory(game);
 }
예제 #12
0
 public Scene(Game1 game)
 {
     this.game = game;
 }
예제 #13
0
 public StarMario(IMario decoratedMario, Game1 game)
 {
     this.decoratedMario = decoratedMario;
     theGame             = game;
     MusicManager.Instance.SetBackgroundMusic("star-theme");
 }
예제 #14
0
 public BlockFactory(Game1 game)
 {
     this.texture = game.Content.Load<Texture2D>("tiles-2");
 }
예제 #15
0
 public GameoverCommand(Game1 receiver)
 {
     this.receiver = receiver;
 }
예제 #16
0
 public EnemyFactory(Game1 game)
 {
     this.texture = game.Content.Load<Texture2D>("Enemies");
 }
예제 #17
0
 public VictoryScreen(Game1 game)
 {
     this.game = game;
     texture = game.Content.Load<Texture2D>("victory");
     oldState = Keyboard.GetState();
 }
예제 #18
0
 public GameOverScreen(Game1 game)
 {
     this.game = game;
     texture = game.Content.Load<Texture2D>("gameover");
     oldState = Keyboard.GetState();
 }
예제 #19
0
 public ItemFactory(Game1 game)
 {
     this.texture = game.Content.Load<Texture2D>("items-objects");
 }
예제 #20
0
 public BlockFactory(Game1 game)
 {
     this.texture = game.Content.Load<Texture2D>("tiles-2");
     this.texture2 = game.Content.Load<Texture2D>("items-objects");
     this.game = game;
 }
예제 #21
0
 public MuteCommand(Game1 receiver)
 {
     this.receiver = receiver;
 }
예제 #22
0
 public PauseCommand(Game1 receiver)
 {
     this.receiver = receiver;
 }
예제 #23
0
 public QuitCommand(Game1 receiver)
 {
     this.receiver = receiver;
 }
예제 #24
0
 public VictoryCommand(Game1 receiver)
 {
     this.receiver = receiver;
 }
예제 #25
0
 public ResetCommand(Game1 receiver)
 {
     this.receiver = receiver;
 }