/// <summary> /// Timer which checks if an input has been made to move characters /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void _tmrMovementCheck_Tick(object sender, EventArgs e) { _2DlevelPlayer[Character._yPlayerPositionMap, Character._xPlayerPositionMap] = 'P'; _pbxGridMain[Character._yPlayerPosition, Character._xPlayerPosition].BackColor = Color.DeepSkyBlue; _playerCollision = _characterCollision.EnemyCollision(_2DlevelEnemies, _playerCollision); if (_playerCollision == true) { _playerCollision = false; SetupPlayerHealth(); if (Character._playerHealth == 0) { _gameIdle = true; GameIdle(); _GridMainMap.Controls.Clear(); _GridMainMap.BackgroundImage = Image.FromFile("InkedGameOver_LI.jpg"); _GridMainMap.Controls.Add(_lblRetry); _lblRetry.Visible = true; } } if (_2DlevelMap[Character._yPlayerPositionMap, Character._xPlayerPositionMap] == '@' && _yPlayerMiniMapPosition == 3) { _lblExit.Visible = true; if (Keyboard.IsKeyDown(Key.Space)) { _gameIdle = true; GameIdle(); _GridMainMap.Controls.Clear(); _GridMainMap.BackgroundImage = Image.FromFile("Victory.jpg"); _lblExit.Visible = false; } } else { _lblExit.Visible = false; } if (Keyboard.IsKeyDown(Key.W)) { _2DlevelPlayer[Character._yPlayerPositionMap, Character._xPlayerPositionMap] = ' '; _playerMove.PositionUp(_pbxGridMain, _2DlevelMap, _zero); _playerCollision = _characterCollision.ItemCollision(_2DlevelEntity); if (_playerCollision == true) { SetupPlayerStats(); } } else if (Keyboard.IsKeyDown(Key.A)) { _2DlevelPlayer[Character._yPlayerPositionMap, Character._xPlayerPositionMap] = ' '; _playerMove.PositionLeft(_pbxGridMain, _2DlevelMap, _zero); _playerCollision = _characterCollision.ItemCollision(_2DlevelEntity); if (_playerCollision == true) { SetupPlayerStats(); } } else if (Keyboard.IsKeyDown(Key.S)) { _2DlevelPlayer[Character._yPlayerPositionMap, Character._xPlayerPositionMap] = ' '; _playerMove.PositionDown(_pbxGridMain, _2DlevelMap, _zero); _playerCollision = _characterCollision.ItemCollision(_2DlevelEntity); if (_playerCollision == true) { SetupPlayerStats(); } } else if (Keyboard.IsKeyDown(Key.D)) { _2DlevelPlayer[Character._yPlayerPositionMap, Character._xPlayerPositionMap] = ' '; _playerMove.PositionRight(_pbxGridMain, _2DlevelMap, _zero); _playerCollision = _characterCollision.ItemCollision(_2DlevelEntity); if (_playerCollision == true) { SetupPlayerStats(); } } if (BulletShoot._attack == false) { BulletShoot._yBulletPositionMap = Character._yPlayerPositionMap; BulletShoot._xBulletPositionMap = Character._xPlayerPositionMap; BulletShoot._yBulletPosition = Character._yPlayerPosition; BulletShoot._xBulletPosition = Character._xPlayerPosition; if (Keyboard.IsKeyDown(Key.Right)) { BulletShoot._attack = true; _keyPressedIsRight = true; _tmrBulletCheck.Start(); } else if (Keyboard.IsKeyDown(Key.Left)) { BulletShoot._attack = true; _keyPressedIsLeft = true; _tmrBulletCheck.Start(); } else if (Keyboard.IsKeyDown(Key.Up)) { BulletShoot._attack = true; _keyPressedIsUp = true; _tmrBulletCheck.Start(); } else if (Keyboard.IsKeyDown(Key.Down)) { BulletShoot._attack = true; _keyPressedIsDown = true; _tmrBulletCheck.Start(); } } PlayerSectionSwitch(); }