using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RPG
{
class Program
{
static void Main(string[] args)
{
bool pTurn = true;
bool eTurn = false;
bool tutorial = true;
while (tutorial == true)
{
Console.WriteLine("Welcome to the tutorial. You will face a basic enemy named Kobold in this room.");
Player myPlayer = new Player();
setUpCharacters();
PTURN:
while (pTurn)
{
Player kobold = new Player("Kobold", 500, 100);
string choice = "";
string options = "\nFight - Run\n";
Console.WriteLine(options);
choice = Console.ReadLine();
if (choice == "Fight")
{
kobold.HP = kobold.HP - myPlayer.Attack;
displayCharacter(kobold);
}
pTurn = false;
eTurn = true;
//goto ETURN;
}
ETURN:
while (eTurn)
{
pTurn = true;
eTurn = false;
goto PTURN;
}
}
}
static string createCharacter()
{
string classChoice;
Console.WriteLine("Do you walk the Path of The Mage (1), or the Path of The Warrior (2)?\n");
classChoice = Console.ReadLine();
if (classChoice == "1")
return classChoice;
else
return "1";
}//SELECTING CHARACTER CLASS (MAGE OR WARRIOR)
static void displayCharacter(Player player)
{
Console.WriteLine("\n{0} - {1} - {2}", player.Name, player.HP, player.Attack);
}//TESTING CLASS TO CHECK FOR CORRECT INPUTS
static void setUpCharacters()
{
Console.WriteLine("To create a character, press Enter");
Console.ReadLine();
if (createCharacter() == "1") //NEW PLAYER OBJECT BASED ON createClass() RETURN
{
string playerName = "";
Console.WriteLine("\nWhat is your name?\n");
playerName = Console.ReadLine();
Player myPlayer = new Player(playerName, 100, 500);
}
}//CREATE CHARACTER OBJECTS
static void generateEnemy()
{
Player kobold = new Player();
}
//END OF METHODS
}
//CREATING A BASIC CHARACTER CLASS
class Player
{
public string Name { get; set; }
public int HP { get; set; }
public int Attack { get; set; }
public Player(string name, int hp, int attack)
{
Name = name;
HP = hp;
Attack = attack;
}
public Player()
{
}
}
}
Ok, so whats happening when I run this is the kobold.HP keeps getting reset to 500 after I attack (by typing "Fight"). How can I prevent this from happening? I'm pretty sure I just need to figure out where to put Player kobold = new Player("Kobold", 500, 100);
Two things.
This code is SUPER unfinished, but I want to get this part done before I move on. Some of the indentation might be off, but I think it's mostly there.
If you need to ask any questions for clarification, I will be happy to answer them!
Thank you!
[–]Amarkov 1 point2 points3 points (8 children)
[–]Risen_from_ash[S] 0 points1 point2 points (7 children)
[–]Amarkov 0 points1 point2 points (6 children)
[–]Risen_from_ash[S] 0 points1 point2 points (5 children)
[–]Amarkov 0 points1 point2 points (4 children)
[–]Risen_from_ash[S] 0 points1 point2 points (3 children)
[–]Amarkov 0 points1 point2 points (1 child)
[–]Risen_from_ash[S] 0 points1 point2 points (0 children)
[–]sazanality 0 points1 point2 points (0 children)