iccaros Posted April 24, 2005 Report Share Posted April 24, 2005 ok here is my shell starter for the adventure game..it does nothing but print a banner and do a quick two dice roll.. need to add +++ everything..plus I need to comment so I can keep on track..I'm learning how to read and write files.. I think it would be better if all detail were in a text file.. this way .. this is just an engian and can be more basic.. read part of file in to array.save game to file things like that. a config file would tell the engian how many rooms and frequencey of monsters / itemsbash-2.05b$ cat adventure.cpp/*************************************************************************** * Copyright (C) 2005 by Steve Huskey * * [email protected] * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <ctime>#include <iostream>#include <cstdlib>using namespace std;void clear_screen() // this is for portability of system call you must us the -DUNIX or -DWIN32 option for gcc{#if defined WIN32 // compiler replaces clear_screen() with system("cls"); if -DWIN32 is used with gcc system("cls");#elif defined UNIX // compiler replaces clear_screen() with system("clear") if -DUNIX is used with gcc system("clear");#endif}void welcome_message(){cout << "This is a demo program to a help me learn C++ better and to show how to make a text adventure game.";cout << "If you would like to help with development \nplease see the documetation for more infromation.";cout << "This software is protected under copywrite law and is covered under the GPL license. You have all rights";cout << " that are covered under this license..\nsee http://www.gnu.org/copyleft/gpl.html or the documentation for more infromation" << endl;}int char_gen(){return 0;}int dice_roll(void){int dice;dice = 1 + rand() % 10;return dice;}int rooms(){return 0;}int main(){int dice, dice2;srand ( time(0) );clear_screen();welcome_message();dice = dice_roll();cout << "dice 1 " << dice << endl;dice2 = dice_roll();cout << "dice 2 " << dice2 << endl;return 0;} Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.