public void updateHeight(Collision collision, Level level) { if (!collision.checkEnemyLevelCollision(this, level).Contains("Bottom")) { if (airVelocity <= 15) { airVelocity += 0.5f; } location = new Vector2(location.X, location.Y + airVelocity); } }
public bool Move(Player player, Collision collision, Level level, GameTime gameTime, PlayerAnimations playerAnimations) { if (!Recoil(player)) { if (location.X + enemyTex[currentFrame].Width < player.location.X) { if (!collision.checkEnemyLevelCollision(this, level).Contains("Right")) { direction = 1; location.X += 5; animateMove(gameTime); lastAttack = gameTime.TotalGameTime - TimeSpan.FromSeconds(0.5); return false; } } if (location.X > player.location.X + playerAnimations.playerTex[playerAnimations.currentframe].Width) { if (!collision.checkEnemyLevelCollision(this, level).Contains("Left")) { direction = 0; location.X -= 5; animateMove(gameTime); lastAttack = gameTime.TotalGameTime -TimeSpan.FromSeconds(0.5); return false; } } return true; } return false; }