中易网

怎样用C++编游戏??跪求大侠帮助。。

答案:3  悬赏:20  
解决时间 2021-02-18 11:44
小组要编一个益智游戏,我刚刚学完C++,对编游戏一无所知。。现在经过小组内部成员讨论,定出了内部框架:设置关卡,每一关设一个小游戏,完成游戏获得奖励,直至最后通关。现在我们已经有了几个小游戏的代码,请问怎样把他们联系在一起构成一个整体的游戏呢》??有什么参考书吗??请大侠多多指教。。请发到邮箱[email protected]..不胜感激。。
最佳答案
这个还有什么难的啊?还需要参考书吗?
几个小游戏的代码,你能看懂吗?你的C++学的怎么样?没学过游戏编程的人照样可以编游戏。
还记得以前有个同学,从来没学过编程,学了几节课的basic,dos下的(当时还没有windows),老师根本就没讲过图形相关的编程,人家就编写了功能超级全面的足球游戏,覆盖足球经理,fifa等大部分功能,包括甲A(当时刚有甲A),五大联赛等,虽然功能及其简陋(在当时也算可以了),但是玩起来很有意思。
所以,只要你有思路,想好你要实现什么,然后用C++实现就可以了。没难度,如果是技术细节,可以多问问,但是起码要有个整体思路。然后再具体去做。
现在我教的很多学生,都是只会按照老师教的做,根本就没有自己的想法,创意和思路,这样学编程还有什么意思。
全部回答
怎么没人回答啊,我也在等啊,冬瓜你多加些分啊! #include //standard input/output #include //string manipulation #include //character manipulation and testing #include //file stream #include //used for random function #include //used for better random number #include"draw.h" //run the draw.h file using namespace std; //function declerations void instruction(int& choice); //give instructions and gets choice void usergame(int i); //plays 2nd user game void compgame(int i); //plays against computer //tests current letter and raplaces starred word void test(string word,char letter,int& numwrong,string& temp,int i); //checks current letter and adds it to letters chosen output if not entered already void lchosen(char letter,string& letterchosen,int& check,int& chosencounter,int i); void rnd(string& word,int i); //gets random word from file void drawman(int numguess,int numwrong,int i); //draws hangman inline istream& flush(istream& stream); //flushses cin stream //start of main int main() { int i=0; //counter variable for loops int exit=0; //main loop exit variable int choice; //users input choice for type of game or to exit //main control loop do{ //while exit!=1 system("cls"); //执行系统命令清屏 instruction(choice);//give instructions switch(choice) { case 1: usergame(i);//calls user game break; case 2: compgame(i);//calls computer game break; case 3: cout<<"goodbye"<>choice; while(!cin) { cerr<<"invalid character"<>choice; } system("cls"); } void usergame(int i) { int numguess=0; int numwrong=0; int check; int wordcheck; int end=0; int chosencounter=0; // char letter; string word; string temp; string letterchosen=" "; // do{ cout<<"how many chances does the person have(4--10):"; cin>>numguess; }while(numguess<4||numguess>10); cout<<"enter word 2nd user: "; cin>>word; do{ wordcheck=0; for(int i=0;i>word; } }while(wordcheck==1); temp=word; for(i=0;i>letter; while(!isalpha(letter)) { flush(cin); cout<<"not a letter--enter letter: "; cin>>letter; } lchosen(letter,letterchosen,check,chosencounter,i); if(check==0) { test(word,letter,numwrong,temp,i); } else { ; } system("cls"); } system("cls"); }while(end!=1 && end!=2); if(end==2) { cout<<"correct word was["<>numguess; }while(numguess<4||numguess>10); rnd(word,i); temp=word; for(i=0;i>letter; while(!isalpha(letter)) { flush(cin); cout<<"not a letter---enter letter: "; cin>>letter; } lchosen(letter,letterchosen,check,chosencounter,i); if(check=0) { test(word,letter,numwrong,temp,i); } else { ; } system("cls"); } system("cls"); }while(end!=1&& end!=2); if(end==2) cout<<"correct word was["<in_avail(); return stream.ignore(chars_to_skip); }
你需要构建一个统一的引导界面。由它来调用每一个游戏。然后,你需要在单一游戏结束后,返回结果。所以,你还需要在你构建的引导界面和每一个游戏之间建立连接。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
王俊凯大腿有多粗?几厘米?
孙权几月出生的
本来是坏处的结果变成了好的事情有哪些
敌对空域的背景音乐叫什么
当我们眺望远方的时候,近处的风景便看不清了
砂浆强度评定和混凝土评定,两个标准是不是《
用英语单词oblige和head造句
你好,我尼桑阳光,发动机故障灯亮起,故障读
魏师傅大碗面(春蕾店)地址在哪,我要去那里办
科目一过了,科目二学了两天,怎么退费
哪里可以找到各类年鉴的电子版?
中国电信霍北电信营业厅这个地址在什么地方,
搬运工!~工厂里面的搬运工跟仓管员工作性质有
除了拇指玩还有什么软件可以下载大型游戏
十陵CNG加气站在什么地方啊,我要过去处理事
推荐资讯
致命弯道哪一部好看点
争做美德少年的作文,书信格式,400字左右
after school 练舞时lizzy受伤不知道现在回归
四川省宣汉县地税局第四税务所(旧)地址有知道
有没有可以装照片的,像怀表那种,最好是翻盖
disclosing entity是什么意思
vans的那个款
中国农业银行佛山南庄牛墟支行在什么地方啊,
东北学开发去哪?
枫叶胶的酸味有毒么?
婚嫁金必须要满22周岁可以取、还是必须等保险
江南大学宿舍分布情况
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?