New link in the top of page "IRC Chat".
Register | Login
Views: 122511678
Main | Memberlist | Active users | Calendar | Last Posts | IRC Chat | Online users
Ranks | FAQ | XPW | Stats | Color Chart | Photo album
03-28-24 08:14 PM
0 users currently in Xeo's Hot Tub.
Xeogaming Forums - Xeo's Hot Tub - My journey learning C++... | |
Next newer thread | Next older thread
User Post
Ryan

Ptooie
Is back!









Since: 10-01-04
From: Stafford, UK

Since last post: 4406 days
Last activity: 4366 days
Posted on 07-26-07 05:41 AM Link | Quote
Yup, I'm already accomplishing number 2 of my list of things to do if I was told I'd die in 'x' amount of time.

And here is my first attempt at programming a game... Well, I call it a game... It's just a bunch of text that describes a battle, you've got to attack the enemy etc.

It's very basic.

Linky to the download

I put it on my web hosting space so it shouldn't have 20 adverts before you get to the download.

Also, don't be put off by it's size and icon-less exe file. It's not a virus! I swear!

This is just showing my progress over learning C++ for a day by a book. I'm already onto conditional branches and shit like that which is pretty fun. And C++ Is much easier to code than I first thought, and easier than one of my friends made out.

And I didn't put this in technical because the game is soooo crap and stupid it's ridiculous! That and this thread wouldn't get any activity in there...





And here is the source code for anyone who can see it:

// Testing Shit
// Ryan Whitehead - Learning C++

#include
#include
#include

using namespace std;

int main()
{
// Declaring bunches of variables for the program to use
// some time later on, but then again, might not do.
int nPlayerHealth = 100;
int nPlayerMana = 100;
int nEnemy1Health = 40;
int nEnemy2Health = 60;
int nEnemy3Health = 100;
string szPlayerName;
string szEnemy1Name = "Astaroth";
string szEnemy2Name = "Behemoth";
string szEnemy3Name = "Maximum Ride";

// Game intro for player
cout << "Welcome to Ryan Whitehead's battle program.n";
cout << "Yes, I know it's crap, before you tell me.n";
cout << "Just bear with it and destroy the enemy bastards!n";
system("PAUSE");

// Ask for player's name
cout << "nNow, traveller, what be your name: ";
cin >> szPlayerName;
cout << "Ah, your name is ";
cout << szPlayerName;
cout << ". Welcome to my humble little world of darkness and text!n";
system("PAUSE");

// Player now battles Enemy 1
cout << "nn";
cout << "OH NOES!!! You have encountered ";
cout << szEnemy1Name;
cout << "!n";
// Start of battle While loop
while(nEnemy1Health > 0 | nPlayerHealth > 0)
{
// General battle text
cout << szPlayerName;
cout << "'s Health: ";
cout << nPlayerHealth;
cout << "n";
cout << szPlayerName;
cout << "'s Mana: ";
cout << nPlayerMana;
cout << "n";
cout << szEnemy1Name;
cout << "'s Health: ";
cout << nEnemy1Health;
cout << "nn";
cout << "Available Attacks:n";
cout << "1. Slashn";
cout << "2. Stabn";
cout << "3. Fireball (Requires 20 mana)n";
cout << "4. Thunder (Requires 20 mana)n";
cout << "5. Cure (Requires 40 mana)n";

// Player attack input
cout << "Enter the number of the ability you want to perform: ";
int nAttackNum;
cin >> nAttackNum;
cout << "n";

// Attack 1 chosen
if (nAttackNum == 1)
{
cout << "You slashed ";
cout << szEnemy1Name;
cout << " for 10 damage!n";
nEnemy1Health = nEnemy1Health - 10;
cout << szEnemy1Name;
cout << " slashes you for 5 damage.n";
nPlayerHealth = nPlayerHealth - 5;
cout << "n";
}

// Attack 2 chosen
if (nAttackNum == 2)
{
cout << "You stabbed ";
cout << szEnemy1Name;
cout << " for 15 damage!n";
nEnemy1Health = nEnemy1Health - 15;
cout << szEnemy1Name;
cout << " slashes you for 5 damage.n";
nPlayerHealth = nPlayerHealth - 5;
cout << "n";
}

// Attack 3 chosen
if (nAttackNum == 3)
{
cout << "You threw a fireball at ";
cout << szEnemy1Name;
cout << " and inflicted 25 damage!n";
nEnemy1Health = nEnemy1Health - 25;
cout << szEnemy1Name;
cout << " bites you for 10 damage.n";
nPlayerHealth = nPlayerHealth - 10;
cout << "n";
}

// Attack 4 chosen
if (nAttackNum == 4)
{
cout << "You cast thunder on ";
cout << szEnemy1Name;
cout << " and caused 20 damage!n";
nEnemy1Health = nEnemy1Health - 20;
cout << szEnemy1Name;
cout << " Headbutts you for 25 damage.n";
nPlayerHealth = nPlayerHealth - 25;
cout << "n";
}

// Attack 5 chosen
if (nAttackNum == 5)
{
cout << "You cast heal and revived your health by 50 points!";
nPlayerHealth = nPlayerHealth + 50;
cout << szEnemy1Name;
cout << " attacks you for 5 damage.nn";
nPlayerHealth = nPlayerHealth - 5;
}

// Attack DEBUG chosen
if (nAttackNum == 6)
{
cout << "Just a test attack to see if player can die!n";
cout << szEnemy1Name;
cout << " struck you down by inflicting 100 damage.nn";
nPlayerHealth = nPlayerHealth - 100;
}

// Incorrect number queries
// Number entered is above 6
if (nAttackNum > 6)
{
cout << "You cannot use that number, try again: ";
cin >> nAttackNum;
}

// Number entered is below 0
if (nAttackNum < 1)
{
cout << "You cannot use that number, try again: ";
cin >> nAttackNum;
}

// Check to see if player or enemy is dead
if (nPlayerHealth <= 0 | nEnemy1Health <= 0)
{
break;
}

}

if (nPlayerHealth <= 0)
{
cout << "Sorry, you lost!";
}

if (nEnemy1Health <= 0)
{
cout << "Congratulations! You win the fight!";
}

// End of game
cout << "nn";
cout << "Thank you for playing my crap (And completely unfinished) game!n";

system("PAUSE");
return 0;

}
Lord Vulkas Mormonus

Vile
High Xeodent of Xeomerica.








Since: 10-29-04
From: North Carolina, United States. World, Sol System, milky way

Since last post: 170 days
Last activity: 152 days
Posted on 07-26-07 07:22 AM Link | Quote
Heh, just played though it. Nice battle system.

Now all you need is the ability to fight multiple enemies at once!

EDIT: Oh yeah, you forgot to make it take away mana when I cure.


(Last edited by Vulkar on 07-26-07 10:28 AM)
Ryan

Ptooie
Is back!









Since: 10-01-04
From: Stafford, UK

Since last post: 4406 days
Last activity: 4366 days
Posted on 07-26-07 10:37 AM Link | Quote
Yeah, I fixed that problem now, although it's not in the one on the download.

I'm also implementing the next two enemies.

To do list:
1) More enemies.
2) Randomizer to allow for missed attacks and so the enemy can do non-static attacks. (Notice how if you use the same attack, the enemy always uses the same attack)
3) Leveling system.
4) Fight multiple enemies at once.
5) A plot and a traveling system
6) Inventory.
7) Graphics. (Huh, yeah right)
Next newer thread | Next older thread
Xeogaming Forums - Xeo's Hot Tub - My journey learning C++... |



xeogaming.org

AcmlmBoard 1.92++ r4 Baseline
?2000-2013 Acmlm, Emuz, Blades, Xkeeper, DarkSlaya*, Lord Alexandor*
*Unofficial Updates
Page rendered in 0.173 seconds.
0.036