Thursday 11 March 2010

My way of getting to know C#

Over the last few days I've been messing around in Visual Studio, non-stop :P

Anyway, I've come to a turning point in making my lil' game so I might aswell dump it online for everyone (or noone) to see.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Text_Adventure
{ //A1
class Program
{ //A2
public static void Main(string[] args)
{ //A3
//Player Details////////////////
string Gender = " ";////////////
string YourName = " ";//////////
string Age = " ";///////////////
string Town = " ";//////////////
//Player Stats//////////////////
int lvl = 0;////////////////////
int Strength = 7 + (lvl * 2);///So... your level * 2 + 7 = player strength.
int HP = Strength * 2;//////////
int MP = 5;/////////////////////
int XP = 0;/////////////////////
int Weapon = 0; //0= fists, 2=Goblin Spear, 3=Bronze Sword, 4=Sturdy Bronze Sword, 5=Rusted Iron Sword
int Armour = 0;
int MaxDamage = Strength + Weapon + 7; //7 is your players Max base damage.
int MinDamage = Strength + Weapon + 3; //3 is your players Min base damage.
int q = 0 - Armour; // Damage Recieved
int x = 0; // x = last amount of damage delt. This is forever changing.
int y = 0; // y = This number changes when you kill a monster, it rolls for what item loot you'll obtain.
//Goblin Stats//////////////////
int GoblinHP = 25;//////////////
int GoblinMaxDamage = 3;////////
int GoblinMinDamage = 1;////////
int TEMPint = 0;////////////////
//Locations/////////////////////
string TEMP = " ";//////////////
string MyLocation = " ";////////
string Tunnel1 = " ";///////////
string Tunnel2 = " ";///////////
string Tunnel3 = " ";///////////
string Tunnel4 = " ";///////////

Console.WriteLine("Type your Gender (Male/Female)");
Gender = Console.ReadLine();
if ((Gender != "Male") || (Gender != "Female"))
{

}
else
{

}
Console.WriteLine("Type your name");
YourName = Console.ReadLine();
Console.WriteLine("Type your Age");
Age = Console.ReadLine();
Console.WriteLine("Type your Home Town");
Town = Console.ReadLine();
Console.WriteLine("Are you ready to begin? (Available Options: , )");
TEMP = Console.ReadLine();
if (TEMP == "Yes")
{

}
else
{
Console.WriteLine("ERROR: Tough Luck, I haven't worked out how to go back and amend mistakes yet");
Console.ReadLine();
}
Console.WriteLine("");
Console.WriteLine("Opening your eyes you find yourself underground in a dungeon.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine("The air is damp and visibility is poor. The smell of death surrounds you.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine("Reaching for your sword you find it missing.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine("A goblin jousts his spear in your direction. You brace yourself for combat.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();

{//starting combat
Console.WriteLine("Combat Options: ");
TEMP = Console.ReadLine();
if (TEMP == "Punch")
{
Random Random_Number = new Random();
x = Random_Number.Next(MinDamage, MaxDamage);
GoblinHP = GoblinHP - x;
}
else
{
Console.WriteLine("ERROR: Tough Luck, I haven't worked out how to go back and amend mistakes yet");
Console.ReadLine();
} //the line below this is Goblin Hitpoints = Goblin Hitpoints - Damage.
Console.WriteLine("You deal " + x + " damage leaving the enemy with " + GoblinHP + " life");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine("The goblin dashes in your direction");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Random Random_Number1 = new Random();
q = Random_Number1.Next(GoblinMinDamage, GoblinMaxDamage);
HP = HP - q;
Console.WriteLine("Piercing your leather rags, the Goblin deals " + q + " damage leaving you with " + HP + "HP");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine("Combat Options: ");
TEMP = Console.ReadLine();
if (TEMP == "Punch")
{
Random Random_Number2 = new Random();
x = Random_Number2.Next(MinDamage, MaxDamage);
GoblinHP = GoblinHP - x;
}
else
{

}
Console.WriteLine("You deal " + x + " damage leaving the enemy with " + GoblinHP + " life");
if (GoblinHP < 1)
{
Console.WriteLine("Congratulations. You defeated the Goblin!");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Random ItemReward = new Random();
y = ItemReward.Next(1, 3);
if (y == 1)
{
Console.WriteLine("+10 xp");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine(YourName + " looted Bronze Sword.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Weapon = 3;
XP = 10;
}
if (y == 2)
{
Console.WriteLine("+10 xp");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine(YourName + " looted Goblin Spear.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Weapon = 2;
XP = 10;
}
if (y == 3)
{
Console.WriteLine("+10 xp");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine(YourName + " looted Goblin Chainmail.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Armour = 1;
XP = 10;
}
}
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine("The Goblin, dazed; dashed once again.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Random Random_Number3 = new Random();
q = Random_Number3.Next(GoblinMinDamage, GoblinMaxDamage);
HP = HP - q;
Console.WriteLine("Piercing your leather rags, the Goblin deals " + q + " damage leaving you with " + HP + "HP");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine("Combat Options: ");
TEMP = Console.ReadLine();
if (TEMP == "Punch")
{
Random Random_Number4 = new Random();
x = Random_Number4.Next(MinDamage, MaxDamage);
GoblinHP = GoblinHP - x;
}
else
{
Console.WriteLine("ERROR: Tough Luck, I haven't worked out how to go back and amend mistakes yet");
Console.ReadLine();
} //the line below this is Goblin Hitpoints = Goblin Hitpoints - Damage.
Console.WriteLine("You deal " + x + " damage leaving the enemy with " + GoblinHP + " life");
if (GoblinHP < 1)
{
Console.WriteLine("Congratulations. You defeated the Goblin!");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Random ItemReward = new Random();
y = ItemReward.Next(1, 3);
if (y == 1)
{
Console.WriteLine("+10 xp");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine(YourName + " looted Bronze Sword.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Weapon = 3;
XP = 10;
}
if (y == 2)
{
Console.WriteLine("+10 xp");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine(YourName + " looted Goblin Spear.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Weapon = 2;
XP = 10;
}
if (y == 3)
{
Console.WriteLine("+10 xp");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Console.WriteLine(YourName + " looted Goblin Chainmail.");
Console.WriteLine("Click Enter to continue...");
Console.ReadLine();
Armour = 1;
XP = 10;
}
}
}//Finishing Combat
} //A3
} //A2
} //A1

No comments:

Post a Comment