//this is the return move method in the hero class public override MovementOfCharacter ReturnMove(MovementOfCharacter movementOfPlayer) { if (movementOfPlayer == MovementOfCharacter.Left) { if (PlayerObserver[1] is emptyTile || PlayerObserver[1] is ItemClass) { movementOfPlayer = MovementOfCharacter.Left; PositionY--; } else { movementOfPlayer = MovementOfCharacter.NoMovement; } } else if (movementOfPlayer == MovementOfCharacter.Up) { if (PlayerObserver[0] is emptyTile || PlayerObserver[0] is ItemClass) { movementOfPlayer = MovementOfCharacter.Up; PositionX--; } else { movementOfPlayer = MovementOfCharacter.NoMovement; } } else if (movementOfPlayer == MovementOfCharacter.Right) { if (PlayerObserver[3] is emptyTile || PlayerObserver[3] is ItemClass) { movementOfPlayer = MovementOfCharacter.Right; PositionY++; } else { movementOfPlayer = MovementOfCharacter.NoMovement; } } else if (movementOfPlayer == MovementOfCharacter.Down) { if (PlayerObserver[2] is emptyTile || PlayerObserver[2] is ItemClass) { movementOfPlayer = MovementOfCharacter.Down; PositionX++; } else { movementOfPlayer = MovementOfCharacter.NoMovement; } } return(movementOfPlayer); }
//this is for the PLAYER MOVEMENT public bool MovePlayer(MovementOfCharacter dir) { if (mapDisplay.PlayerCharacter.ReturnMove(dir) == MovementOfCharacter.NoMovement) { return(false); } else { ItemClass pickUp = mapDisplay.GetItemAtPosition(mapDisplay.PlayerCharacter.PositionX, mapDisplay.PlayerCharacter.PositionY); if (pickUp != null) { mapDisplay.PlayerCharacter.PickUp(pickUp); } return(true); } }
//this is a method for movement of the Character public void Move(MovementOfCharacter MovementOfCharacter) { if (MovementOfCharacter == MovementOfCharacter.Down) { PositionY++; } else if (MovementOfCharacter == MovementOfCharacter.Up) { PositionY--; } else if (MovementOfCharacter == MovementOfCharacter.Left) { PositionX--; } else if (MovementOfCharacter == MovementOfCharacter.Right) { PositionX++; } }
//this is a method for movement of the Character public void Move(MovementOfCharacter direction) { if (direction == MovementOfCharacter.Down) { PositionY++; } else if (direction == MovementOfCharacter.Up) { PositionY--; } else if (direction == MovementOfCharacter.Left) { PositonX--; } else if (direction == MovementOfCharacter.Right) { PositonX++; } else { } }
//this places the move at zero in return method public abstract MovementOfCharacter ReturnMove(MovementOfCharacter move = 0);
//this is the return method in the mage class public override MovementOfCharacter ReturnMove(MovementOfCharacter playerCharacterMovement = 0) { return(MovementOfCharacter.NoMovement); }
//this is the return move method within the goblin class public override MovementOfCharacter ReturnMove(MovementOfCharacter movementStructure = 0) { int randomRollSelect = select.Next(0, 4); movementStructure = MovementOfCharacter.NoMovement; while (movementStructure == MovementOfCharacter.NoMovement) { if (randomRollSelect == 0) { if (PlayerObserver[0] is emptyTile) { movementStructure = MovementOfCharacter.Left; PositionX--; } else { randomRollSelect = select.Next(0, 4); } } else if (randomRollSelect == 1) { if (PlayerObserver[1] is emptyTile) { movementStructure = MovementOfCharacter.Up; PositionY--; } else { randomRollSelect = select.Next(0, 4); } } else if (randomRollSelect == 2) { if (PlayerObserver[2] is emptyTile) { movementStructure = MovementOfCharacter.Right; PositionX++; } else { randomRollSelect = select.Next(0, 4); } } else if (randomRollSelect == 3) { if (PlayerObserver[3] is emptyTile) { movementStructure = MovementOfCharacter.Down; PositionY++; } else { randomRollSelect = select.Next(0, 4); } } else { movementStructure = MovementOfCharacter.NoMovement; } } return(movementStructure); }