public DeathCaveGame() { this.gv = new GameVars(); strLevels = new List<string>(); strLevels.Add("levels/00.lvl"); strLevels.Add("levels/01.lvl"); strLevels.Add("levels/02.lvl"); strLevels.Add("levels/03.lvl"); strLevels.Add("levels/04.lvl"); strLevels.Add("levels/05.lvl"); this.StartGame(); this.StartRound(); }
/// <summary> /// Called when it is time to setup the next frame. Add you game logic here. /// </summary> /// <param name="e">Contains timing information for framerate independent logic.</param> public override void OnUpdateFrame(UpdateFrameEventArgs e) { InputEnum IE = new InputEnum(); if (Joysticks.Count > 0) { if (Joysticks[0].Axis[1] > 0.2f) IE |= InputEnum.Player1Up; if (Joysticks[0].Axis[1] < -0.2f) IE |= InputEnum.Player1Down; if (Joysticks[0].Axis[0] < -0.2f) IE |= InputEnum.Player1Left; if (Joysticks[0].Axis[0] > 0.2f) IE |= InputEnum.Player1Right; if (Joysticks[0].Button[0]) { if (!this.spaceDown) { this.spaceDown = true; IE |= InputEnum.Player1Fire; } } else this.spaceDown = false; } else { // Process held down keyboard inputs if (Keyboard[Key.Up]) IE |= InputEnum.Player1Up; if (Keyboard[Key.Down]) IE |= InputEnum.Player1Down; if (Keyboard[Key.Left] ) IE |= InputEnum.Player1Left; if (Keyboard[Key.Right]) IE |= InputEnum.Player1Right; if (Keyboard[Key.Space]) { if (!this.spaceDown) { this.spaceDown = true; IE |= InputEnum.Player1Fire; } } else this.spaceDown = false; } gv = dcg.Process(IE, (float)e.Time); if (Keyboard[Key.Escape]) Exit(); }