![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2006
Posts: 21
Rep Power: 0
![]() |
I'm new at C++ and I want to make a cool text-based rpg. My complier is Dev-C++. Can someone help me out get started? Maybe if you have one of your own I could examine the source code. It would be really cool if someone with some experiance could help me with this. Please help as much as you can, but don't sweat it. Thanks. :banana: (I'm so excited lol)
|
|
|
|
|
|
#2 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
What type of help are you looking for exactly? If you're looking for source-code to use as an example, you could try searching at www.planetsourcecode.com .
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
this is my half arse attempt at stratego. it is not an rpg but it would help. i need to comment more. do not the modular programing useing functions.
main code #include <iostream>
#include <conio>
#include <string>
#include <fstream>
using namespace std;
//players 2-10. spy, bomb, flag
//flag = 0
//bomb = 1
//spy = 11
//freespace = -1
//water = -2
//map 10 X 10
//(0,0) = (5,3)
void printMap(); //pints map grid on screen
void printArray(int map[10][10]);//test to see whats in the map array
void printUnit(int x, int y, int unit);// print on screen units
// this is the for loop for the templet
void mainPlace(int map[10][10], string unitName[12], int amount[12], int arrayVal[12]);
//this is the repeted code
void placeTemp(int map[10][10], string unit, int mount, int val);
//return checkOpen(int map[10][10], int x, int y);
int main()
{
int map[10][10];
int amount[12] = {1,6,1,8,5,4,4,4,3,2,1,1};
int arrayVal[12] = {0,1,11,2,3,4,5,6,7,8,9,10};
string unitName[12] = {"Flag","Bombs","Spy","Scouts","Miners","Sergeants",
"Lieutenants","Captains","Majors","Colonels","General","Marshal"};
getchar();
system("cls");
printMap();
mainPlace(map, unitName, amount, arrayVal);
//printArray(map);
getchar();
return 0;
}
void printMap()
{
string mapImage;
ifstream myFile ("map.txt");
if (myFile.is_open())
{
while (! myFile.eof() )
{
getline (myFile,mapImage);
cout << mapImage << endl;//have this be into into array
}
myFile.close();
}
else cout << "Unable to open file";
}
void printArray(int map[10][10])
{
for (int y = 0; y < 10; y++)
{
for (int x = 0; x < 10; x++)
{
cout << map[x][y] << " ";
}
cout << endl;
}
}
void printUnit(int x, int y, int unit)
{
gotoxy((2 * x) + 5,(2 * y) + 3);
if ((unit > 1) && (unit < 10))
cout << unit;
else
{
switch (unit)
{
case 0 : cout << "F";//flag
break;
case 1 : cout << "B";//bomb
break;
case 10: cout << "M";//marshal, 10's unit to big to be displayed on map
break;
case 11: cout << "S";//spy
break;
}
}
}
void mainPlace(int map[10][10], string unitName[12], int amount[12], int arrayVal[12])
{
gotoxy(30,5);
cout << " Place ";
gotoxy(30,6);
cout << "-------------------";
for (int i = 0; i < 12; i++)
{
placeTemp(map, unitName[i], amount[i], arrayVal[i]);
}
}
void placeTemp(int map[10][10], string unit, int mount, int val)
{
int x,y;
gotoxy(37,5);
cout << unit << " " << endl;
for (int i = 0; i < mount; i++)
{
gotoxy(30,7);
cout << "location( , ) " << (mount - i);
gotoxy(39,7);
cin >> x;
gotoxy(41,7);
cin >> y;
map[x][y] = val;
printUnit(x,y,val);
}
}map X 0 1 2 3 4 5 6 7 8 9
Y - - - - - - - - - -
0 | | | | | | | | | | |
- - - - - - - - - -
1 | | | | | | | | | | |
- - - - - - - - - -
2 | | | | | | | | | | |
- - - - - - - - - -
3 | | | | | | | | | | |
- - - - - - - - - -
4 | | |w|w| | |w|w| | |
- - - - - - - - - -
5 | | |w|w| | |w|w| | |
- - - - - - - - - -
6 | | | | | | | | | | |
- - - - - - - - - -
7 | | | | | | | | | | |
- - - - - - - - - -
8 | | | | | | | | | | |
- - - - - - - - - -
9 | | | | | | | | | | |
- - - - - - - - - -is this too long?
__________________
i dont know much about programming but i try to help |
|
|
|
|
|
#4 |
|
Newbie
Join Date: May 2006
Posts: 21
Rep Power: 0
![]() |
Thanks
Yeah, this definitly helps alot. I'm a newb so I am just looking for source code examples. Mjordan2nd, I'll definitly check out that site. mrynit, your Strategeo game looks pretty good, and when it's done, my I suggest submiting it to gamehippo.com. It's a website that allows you to download freeware games. It would probably have a nice turnout, as they review every game, and there's only one other Stratego game on it that was made with Java and normally doesn't work. Just an idea. Thanks. :banana:
|
|
|
|
|
|
#5 |
|
Newbie
Join Date: May 2006
Posts: 21
Rep Power: 0
![]() |
Any more posts on this thread would be gratefully accepted.
__________________
Kids, every year, more than 400,000 people die from tobacco chewing, smoking, an- MY GOD, HERE COMES A ZOMBIE PIRATE NINJA!!!!!! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|