what do you think of my game?
Hello, I have just made my first game in C++ it is text based please tell me what you think.Also please note that it is not finished.
Code:
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
int main()
{
//charicter variables
string action;
int lose;
int battle;
int player_health;
int player_attack;
int Player_weapon;
int monster_attack;
int monster_health;
//variables for random number limit
int player_attack_low;
int player_attack_high;
int monster_attack_low;
int monster_attack_high;
//item variables
string item_use;
//iventory variables
int potion_health_ammount;
int potion_poison_ammount;
Player_weapon= 1;
battle = 1;
lose = 0;
potion_health_ammount = 1;
potion_poison_ammount = 1;
//code for random numbers used for attack
time_t seconds;
time(&seconds);
srand((unsigned int) seconds);
cout<<"round one! player V zombie \n";
//setting attck limit variables
if(Player_weapon = 1){ //fist
player_attack_low = 0;
player_attack_high = 3;
}
else if(Player_weapon = 2){ //sword
player_attack_low = 6;
player_attack_high = 8;
}
else if(Player_weapon = 3){ //axe
player_attack_low = 0;
player_attack_high = 11;
}
monster_attack_low = 0;
monster_attack_high = 2;
player_health = 20;
monster_health = 15;
cout<<"your health is "<<player_health<<"\n";
cout<<"the zombies health is "<<monster_health<<"\n";
while(battle == 1){
cout<<"\n\n\nattack, item or pass? \n";
cin>>action;
if(action == "attack"){
player_attack = rand() % (player_attack_high - player_attack_low + 1) + player_attack_low;
monster_health = monster_health - player_attack;
cout<<"you do "<<player_attack<<" damage.\nThe zombie's health is "<<monster_health<<"\n";
monster_attack = rand() % (monster_attack_high - monster_attack_low + 1) + monster_attack_low;
player_health = player_health - monster_attack;
cout<<"\nyou take "<<monster_attack<<" damage \nYour health is now "<<player_health;
if(player_health < 1){
cout<<"you lose";
}
else if(monster_health < 1){
cout<<"\n\n\nyou won this round well done!";
battle = 0;
}
else{
cout<<"\n\n next turn \n\n";
}}
else if(action == "pass"){
monster_attack = rand() % (monster_attack_high - monster_attack_low + 1) + monster_attack_low;
player_health = player_health - monster_attack;
cout<<"\nyou take "<<monster_attack<<" damage \nYour health is now "<<player_health;
}
else if(action == "item"){
cout<<"you have\n"<<potion_health_ammount<<" healing potion(potion)\n"<<potion_poison_ammount<<" posion(poison)\n\n";
cout<<"item to use: ";
cin>>item_use;
if(item_use == "potion"){
player_health = player_health + 5;
cout<<"you have healed by 5\n";
}
else if(item_use == "poison"){
monster_health = monster_health - 5;
cout<<"5 damage given to zombie\n";
}
monster_attack = rand() % (monster_attack_high - monster_attack_low + 1) + monster_attack_low;
player_health = player_health - monster_attack;
cout<<"\nyou take "<<monster_attack<<" damage \nYour health is now "<<player_health;
}
}
return 0;
}