C++ game?
Please support our C++ advertiser: Programming Forums
![]() |
Is it possible to make a very simple game with C++? any good sites to read up on how to do it? I have a program called Dev-C++. any kind of tips or code that i should know? I'm am just a noob at C++. I wish to play with it before I attend a computer programing camp during this summer. thanks
Owner/PC Technician of:
The PC Doctor
"If we can't fix it, it's just not fixable"
The PC Doctor
"If we can't fix it, it's just not fixable"
•
•
Posts: 5
Reputation:
Solved Threads: 0
Of course it is possible. I've been thinking about making a command-line (text) based RPG with C++. What you could do is say, create some bad guys, create a menu of what the user can do to them, randomize some attacks and etc... It will take a lot of function work but yes it could be done. I don't know of any good sites that provide basic game info. But there are lots of OpenGL sites and advanced sites. But you won't make a 3D game by this summer so I'd stick with command line stuff.
C/C++ is a fully functional language, you make the computer do virtually ANYTHING you want. The limitations of the language can be overcome with experience and skills.
BTW: 73.2 % of all games on the market are created in C/C++ in cluding popular titles such as Warcraft 3, and Diablo 2.
BTW: 73.2 % of all games on the market are created in C/C++ in cluding popular titles such as Warcraft 3, and Diablo 2.
A Hacker's Mind:
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
•
•
Posts: 5
Reputation:
Solved Threads: 0
I just wrote a small game in C++. I also have the source code to a few RPG games. It actually isn't that hard to make a console RPG. And as BountyX said, funny you should ask if games could be made in C++ because almost all games are. So you've picked the right language! You wouldn't want Java or C# as much because they are slower languages.
•
•
Posts: 28
Reputation:
Solved Threads: 0
i wrote it a while ago but anyways...
Dice Game
<< moderator edit: added [code][/code] tags >>
Dice Game
/*
Name: Dice Game
Author: Bleek
Description: Game
Date: N/A
Copyright: N/A
*/
#include <iostream>
#include <time.h>
#include <cstdlib>
#include <windows.h>
using namespace std;
void one();
void two();
void three();
void four();
void five();
void six();
//Declare Functions used
int main()
{
short unsigned int score = 0;
short unsigned int compScore = 0;
short unsigned int num = 0;
short unsigned int num2 = 0;
short unsigned int compNum = 0;
short unsigned int compNum2 = 0;
short unsigned int sum = 0;
short unsigned int compSum = 0;
char letter;
//Declare Variables
srand(time(NULL));
//Initialize random number generator
system("title Joe's Dice Game");
while (letter != 'q')
{
cout << "Your Score: " << score << endl;
cout << "computer's Score: " << compScore << endl << endl;
cout << "Press r to roll or q to quit: ";
cin >> letter;
num = 1 + rand() % (6 - 1 + 1);
num2 = 1 + rand() % (6 - 1 + 1);
compNum = 1 + rand() % (6 - 1 + 1);
compNum2 = 1 + rand() % (6 - 1 + 1);
//Random numbers
sum = num + num2;
compSum = compNum + compNum2;
//Calculate Sums
if (letter == 'q')
break;
if (letter != 'r')
{
system("cls");
continue;
}
switch (num)
{
case 1:
one();
break;
case 2:
two();
break;
case 3:
three();
break;
case 4:
four();
break;
case 5:
five();
break;
case 6:
six();
break;
default:
cout << "Error...";
break;
} //end switch
switch (num2)
{
case 1:
one();
break;
case 2:
two();
break;
case 3:
three();
break;
case 4:
four();
break;
case 5:
five();
break;
case 6:
six();
break;
default:
cout << "Error...";
break;
} //end switch
cout << endl << "Yours: " << num << ", " << num2 << endl;
cout << "Computer's: " << compNum << ", " << compNum2 << "\n\n";
//Display dice and numbers
if (sum > compSum)
{
cout << "You won!!" << endl << endl;
score++;
}
else
{
compScore++;
cout << "you lost..." << endl << endl;
}
//Calculate score
system("pause");
system("cls");
if (score == 12)
{
MessageBox(0, "You Won!!!", "Results:", MB_ICONEXCLAMATION);
break;
}
if (compScore == 12)
{
MessageBox(0, "You lost...", "Results:", MB_ICONEXCLAMATION);
break;
}
}
return 0;
}
void one()
{
cout << " -----" << endl;
cout << "| |" << endl;
cout << "| O |" << endl;
cout << "| |" << endl;
cout << " -----" << endl;
}
void two()
{
cout << " -----" << endl;
cout << "| O|" << endl;
cout << "| |" << endl;
cout << "|O |" << endl;
cout << " -----" << endl;
}
void three()
{
cout << " -----" << endl;
cout << "| O|" << endl;
cout << "| O |" << endl;
cout << "|O |" << endl;
cout << " -----" << endl;
}
void four()
{
cout << " -----" << endl;
cout << "|O O|" << endl;
cout << "| |" << endl;
cout << "|O O|" << endl;
cout << " -----" << endl;
}
void five()
{
cout << " -----" << endl;
cout << "|O O|" << endl;
cout << "| O |" << endl;
cout << "|O O|" << endl;
cout << " -----" << endl;
}
void six()
{
cout << " -----" << endl;
cout << "|O O|" << endl;
cout << "|O O|" << endl;
cout << "|O O|" << endl;
cout << " -----" << endl;
}![]() |
Similar Threads
Other Threads in the C++ Forum
- Word Association Game (Posting Games)
- recall a game with mad red monks? (Geeks' Lounge)
- Big Game need progrmmers (C++)
- PHP Programmer interested in an existing project? Game! =o] (PHP)
- Help With An Online Game! (Web Development Job Offers)
- Your Fav Game (Geeks' Lounge)
Other Threads in the C++ Forum
- Previous Thread: C++ arrays
- Next Thread: Alternatives to arrays?
•
•
•
•
Views: 39634 | Replies: 21 | Currently Viewing: 1 (0 members and 1 guests)





Linear Mode