public void MoveL() { this.Moving = true; //checks if at edge of screen if (this.Position > 1) { //don't need to check if enemy behind if (this.AtkCharged == false) { //as animation has position of square it goes to Animate.ControlableEntityAni(this.Position - 1, this.Position - 1, Animations.PlayerAni("WalkLeft"), 80); } else { Animate.ControlableEntityAni(this.Position - 1, this.Position - 1, Animations.PlayerAni("WalkLeftHammerUp"), 80); } this.Position--; MainClass.PlayerEventSystem.MadeMove("left"); } else { //loads the prev screen if conditions met - enemies = 0, is at edge of screen, not at start of game MainClass.GameMap.PrevScreen(); } }
public void Attack() { this.Moving = false; //note it is a charge attack if (this.AtkCharged == false) { //lift hammer up this.AtkCharged = true; Animate.ControlableEntityAni(this.Position, this.Position, Animations.PlayerAni("LiftHammer")); } else { //swing hammer this.AtkCharged = false; Animate.ControlableEntityAni(this.Position, this.Position, Animations.PlayerAni("Bonk"), 80); //as can't change list while in foreach loop create new list List <Enemy> EtoCheck = new List <Enemy>() { }; foreach (Enemy ETA in MainClass.GameMap.CurrentEnemies) { EtoCheck.Add(ETA); } foreach (Enemy EnemyToAttack in EtoCheck) { if (this.Position == EnemyToAttack.Position - 1) { if (EnemyToAttack.PlanedMove == "dodge") { EnemyToAttack.MakeMove(); EnemyToAttack.TakeDamage(this.Strength, this.BaseDamage); } else { EnemyToAttack.TakeDamage(this.Strength, this.BaseDamage); } } } } this.Moving = true; MainClass.PlayerEventSystem.MadeMove("attack"); }
public void MoveR() { this.Moving = true; //checks if at edge of screen if (this.Position < 6) { bool EnemyInfront = false; foreach (var ens in MainClass.GameMap.CurrentEnemies) { //checks if enemy is infront of player if (ens.Position == this.Position + 1) { EnemyInfront = true; Log.UpdateLog("can't move into Enemy"); } } if (!EnemyInfront) { if (this.AtkCharged == false) { Animate.ControlableEntityAni(this.Position, this.Position + 1, Animations.PlayerAni("WalkRight"), 80); } else { Animate.ControlableEntityAni(this.Position, this.Position + 1, Animations.PlayerAni("WalkRightHammerUp"), 80); } this.Position++; MainClass.PlayerEventSystem.MadeMove("right"); } } else { //loads the next screen if conditions met - enemies = 0, is at edge of screen, not at end of game MainClass.GameMap.NextScreen(); } }