Beispiel #1
0
        public KeyboardController(Game game, ILevel level)
        {
            this.Level    = level;
            this.Keybinds = game.Keybinds;

            ArrayList GameKeys = new ArrayList();

            this.MotionKeys = new ArrayList();
            UpKey           = Keybinds.JumpKeybind.key;

            GameKeys.Add(Keybinds.QuitKeybind.key);
            GameKeys.Add(Keybinds.JumpKeybind.key);
            GameKeys.Add(Keybinds.CrouchKeybind.key);
            GameKeys.Add(Keybinds.LeftKeybind.key);
            GameKeys.Add(Keybinds.RightKeybind.key);
            GameKeys.Add(Keybinds.AttackKeybind.key);
            GameKeys.Add(Keybinds.PauseKeybind.key);

            this.MotionKeys.Add(Keybinds.LeftKeybind.key);
            this.MotionKeys.Add(Keybinds.RightKeybind.key);
            this.MotionKeys.Add(UpKey);
            this.MotionKeys.Add(Keybinds.CrouchKeybind.key);

            //create dictionary of keys and commands
            this.CommandDict = new Dictionary <Keys, ICommand>();
            this.CommandDict.Add((Keys)GameKeys[0], new ShowMenuCommand(game));
            this.CommandDict.Add((Keys)GameKeys[1], new UpCommand(level));
            this.CommandDict.Add((Keys)GameKeys[2], new DownCommand(level));
            this.CommandDict.Add((Keys)GameKeys[3], new LeftCommand(level));
            this.CommandDict.Add((Keys)GameKeys[4], new RightCommand(level));
            this.CommandDict.Add((Keys)GameKeys[5], new FireballCommand(level));
            this.CommandDict.Add((Keys)GameKeys[6], new PauseCommand(level));
        }
 public KeybinderScreen(Game game, int windowWidth, int windowHeight)
 {
     this.Background   = SpriteHolder.Background;
     this.Keybinds     = game.Keybinds;
     this.WindowWidth  = windowWidth;
     this.WindowHeight = windowHeight;
     this.Font         = SpriteHolder.MenuFont;
     this.MarioImg     = SpriteHolder.SmallMario;
     InitKeybindButtons();
 }
Beispiel #3
0
 public Game()
 {
     this.Levels = new ArrayList {
         "Level1-1", "Level1-2"
     };
     Content.RootDirectory = "Content";
     this.Graphics         = new GraphicsDeviceManager(this);
     GameStats.Lives       = 1;
     MenuDisplaying        = true;
     this.LevelString      = (String)Levels[0];
     this.MusicShouldPlay  = true;
     Keybinds = new Keybinder();
 }
Beispiel #4
0
 public Menu(Game game, int windowWidth, int windowHeight)
 {
     this.Game               = game;
     this.Keybinds           = game.Keybinds;
     this.ShowingPage        = Page.Home;
     this.KeyboardController = new MenuKeyboardController(this);
     this.WindowWidth        = windowWidth;
     this.WindowHeight       = windowHeight;
     this.Font               = SpriteHolder.MenuFont;
     this.MarioImg           = SpriteHolder.SmallMario;
     this.Background         = SpriteHolder.Background;
     this.Logo               = SpriteHolder.Game_Logo;
     this.Generator          = new LevelGenerator(this.Game, this.WindowWidth, this.WindowHeight);
     InitButtons();
     InitKeybindButtons();
 }