游戏开发日志2
2025-12-07 22:08:31
发布于:香港
接上回
更新版本:1.0.1
代码:李伙子ia
美术:也没美术啊
翻译:Artificial Intelligence
—————————————————————————————————————————————
更新了1-2:
else if(y==2&&flag[0][0]==1&&flag[0][1]==0){
int HP=s001.health;
cout<<"Monster1: ";
coutime("You kill my friends!I'll kill you back!\n",100);
cout<<s001.name+": ";
coutime("Err...\n",100);
cout<<"Monster2: ";
coutime("Me too!!!\n",100);
player m1={"Monster1 1-2",2,5,98,0,0.0},m2={"Monster2 1-2",2,10,1,0,0.0};
cout<<"Your fitness: "<<s001.health<<", "<<s001.attack<<", "<<s001.defense<<", "<<s001.damage<<endl;
cout<<"Monster1 fitness: "<<m1.health<<", "<<m1.attack<<", "<<m1.defense<<", "<<m1.damage<<endl;
cout<<"Monster2 fitness: "<<m2.health<<", "<<m2.attack<<", "<<m2.defense<<", "<<m2.damage<<endl;
cout<<"A: Attack Monster2("<<s001.attack<<")"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
cout<<"Monster2's health-"<<s001.attack<<endl;
m2.health-=s001.attack;
cout<<"Monster1 attack you. Your's health-"<<m1.attack<<endl;
s001.health-=m1.attack;
cout<<"Monster2 attack you. Your's health-"<<m2.attack<<endl;
s001.health-=m2.attack;
cout<<"Your fitness: "<<s001.health<<", "<<s001.attack<<", "<<s001.defense<<", "<<s001.damage<<endl;
cout<<"Monster1 fitness: "<<m1.health<<", "<<m1.attack<<", "<<m1.defense<<", "<<m1.damage<<endl;
cout<<"Monster2 fitness: "<<m2.health<<", "<<m2.attack<<", "<<m2.defense<<", "<<m2.damage<<endl;
cout<<s001.name+": ";
coutime("Oh No!I just have 1 health!What can I do?\n",100);
cout<<"???: ";
coutime("I can help you.\n",100);
cout<<s001.name+": ";
coutime("???\n",100);
cout<<"You obtain a Greater Health Potion."<<endl;
cout<<"A: Attack Monster1("<<s001.attack<<") and use the Greater Health Potion(99)"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
s001.health=HP;
cout<<"Monster1's health-"<<s001.attack<<endl;
cout<<"Monster1: ";
coutime("Noooo!!!\n",100);
cout<<"Monster1 dead.You award some money(money +"<<m1.money<<")."<<endl;
s001.money+=m1.money;
cout<<"Monster2: ";
coutime("No!!!You kill my another friend!I'll kill you, kill you!!!\n",100);
cout<<"Monster2's angry.His attack +9"<<endl;
m2.attack+=9;
cout<<"Your fitness: "<<s001.health<<", "<<s001.attack<<", "<<s001.defense<<", "<<s001.damage<<endl;
cout<<"Monster2 fitness: "<<m2.health<<", "<<m2.attack<<", "<<m2.defense<<", "<<m2.damage<<endl;
cout<<"Monster2 attack you. Your's health-"<<m2.attack<<endl;
s001.health-=m2.attack;
cout<<"A: Attack Monster2("<<s001.attack<<")"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
cout<<"Monster2's health-"<<s001.attack<<endl;
cout<<"Monster2: ";
coutime("Noooo!!!I haven't taken revenge yet!!!\n",100);
cout<<"Monster2 dead.You award some money(money +"<<m2.money<<")."<<endl;
s001.money+=m2.money;
s001.health=HP;
flag[0][1]=1;
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}
更新了flag(让关卡不能2次挑战和跳关):
int flag[1][2]={{0,0}};//0为未完成关卡,1为已完成关卡
//以1-1展示
if(y==1&&flag[0][0]==0){//判断
int HP=s001.health;
cout<<"Monster: ";
coutime("Hehehe!With me here, you're not getting past.\n",100);
cout<<s001.name+": ";
coutime("Damn!\n",100);
cout<<"Monster: ";
coutime("Unless you can beat me.\n",100);
cout<<s001.name+": ";
coutime("Come on!\n",100);
player m={"Monster 1-1",2,10,2,0,0.0};
while(1){
cout<<"Your fitness: "<<s001.health<<", "<<s001.attack<<", "<<s001.defense<<", "<<s001.damage<<endl;
cout<<"Monster fitness: "<<m.health<<", "<<m.attack<<", "<<m.defense<<", "<<m.damage<<endl;
cout<<"A: Attack("<<s001.attack<<")"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
cout<<"Monster's health-"<<s001.attack<<endl;
m.health-=s001.attack;
if(m.health<=0){
cout<<"Monster: ";
coutime("Oh!You win!\n",100);
cout<<"Monster dead.You award some money(money +"<<m.money<<")."<<endl;
s001.money+=m.money;
s001.health=HP;
flag[0][0]=1;//记录
break;
}
cout<<"Monster attack you. Your's health-"<<m.attack<<endl;
s001.health-=m.attack;
}
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}
更新了跳过前置剧情(虽然没啥剧情):
cout<<"Skip the previous plot?"<<endl;
cout<<"A: No, B: Yes"<<endl;//是否跳过
cout<<"Please choose your choice: ";
cin>>choice;
if(choice=="B"){//是
cout<<"What's your name?"<<endl;
cout<<"Your answer: ";
cin>>s001.name;
system("cls");
}else{//否(默认为否)
/*……*/
}
以后要更新的内容(饼):装备系统在1.1+正式上线
/*version 1.1*/
struct equipment{//装备的结构体
int helmet=0,armor=0,leguard=0,sabaton=0;//防御的
int sword=0;//攻击的
};
/*version 1.1*/
equipment D={0,0,0,0,0};
struct player{
string name="s001";
int money=0;
int health=100,attack=5+D.sword,defense=D.helmet+D.armor+D.leguard+D.sabaton;//装备加成
double damage=0.0;
};
成品:
#include<iostream>
#include<string>
#include<windows.h>
using namespace std;
/*version 1.1*/
struct equipment{
int helmet=0,armor=0,leguard=0,sabaton=0;
int sword=0;
};
/*version 1.1*/
equipment D={0,0,0,0,0};
struct player{
string name="s001";
int money=0;
int health=100,attack=5+D.sword,defense=D.helmet+D.armor+D.leguard+D.sabaton;
double damage=0.0;
};
void coutime(string out,DWORD tIm){
for(int i=0,len=out.size();i<len;i++){
cout<<out[i];
Sleep(tIm);
}
}
int main(){
player s001;
string choice;
int flag[1][2]={{0,0}};
cout<<"The Newbie's Journey Log"<<endl;
cout<<"Version: 1.0.1"<<endl;
cout<<"ID: 001"<<endl;
cout<<"Name: ___"<<endl;
cout<<"Skip the previous plot?"<<endl;
cout<<"A: No, B: Yes"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
if(choice=="B"){
cout<<"What's your name?"<<endl;
cout<<"Your answer: ";
cin>>s001.name;
system("cls");
}else{
Sleep(1000);
cout<<"Village cheif: ";
coutime("What is your name?\n",100);
cout<<"Your answer: ";
cin>>s001.name;
cout<<"Village cheif: "<<endl;
coutime("Hello "+s001.name+"!I am village cheif of novice village.\nI'll help your to start the 'game'.\n",100);
cout<<"A: I what to know the 'basic game rule'.\nPlease choose your choice: ";
cin>>choice;
cout<<"Village cheif: "<<endl;
coutime("You can input these things to do some operate,\n",100);
Sleep(500);
cout<<"Input money: Look over your money amount"<<endl;
cout<<"Input fitness: Look over your health, attack, defense, and damage"<<endl;
cout<<"Input start: Start the 'game'!"<<endl;
cout<<"Input equipment: Look over your helmet, armor, leguard, and sabaton(version 1.1+ officially launch)"<<endl;
Sleep(500);
cout<<"A: OK!\nPlease choose your choice: ";
cin>>choice;
cout<<"Village cheif: "<<endl;
coutime("Goodbye!",100);
system("cls");
}
while(1){
cout<<"The Newbie's Journey Log"<<endl;
cout<<"Version: 1.0.1"<<endl;
cout<<"ID: 001"<<endl;
cout<<"Name: "+s001.name<<endl;
cout<<"Input money: Look over your money amount"<<endl;
cout<<"Input fitness: Look over your health, attack, defense, and damage"<<endl;
cout<<"Input start: Start the 'game'!"<<endl;
cout<<"Input equipment: Look over your helmet, armor, leguard, and sabaton(version 1.1+ officially launch)"<<endl;
cout<<"Please start your operate: ";
cin>>choice;
if(choice=="money"){
cout<<"Your money amount:"<<s001.money<<endl;
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}else if(choice=="fitness"){
cout<<"Your health, attack, defense, and damage:"<<s001.health<<", "<<s001.attack<<", "<<s001.defense<<", "<<s001.damage<<endl;
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}else if(choice=="start"){
// cout<<"C means completed level, and U means uncompleted level."<<endl;
cout<<"Newbie's Guide: ";
cout<<"1-1, 1-2"<<endl;
cout<<"Please choose a level(x-y): ";
int x,y;
cin>>x>>y;
if(x>1||y>2){
cout<<"This mode is only available in version ???"<<endl;
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}else{
if(x==1){
if(y==1&&flag[0][0]==0){
int HP=s001.health;
cout<<"Monster: ";
coutime("Hehehe!With me here, you're not getting past.\n",100);
cout<<s001.name+": ";
coutime("Damn!\n",100);
cout<<"Monster: ";
coutime("Unless you can beat me.\n",100);
cout<<s001.name+": ";
coutime("Come on!\n",100);
player m={"Monster 1-1",2,10,2,0,0.0};
while(1){
cout<<"Your fitness: "<<s001.health<<", "<<s001.attack<<", "<<s001.defense<<", "<<s001.damage<<endl;
cout<<"Monster fitness: "<<m.health<<", "<<m.attack<<", "<<m.defense<<", "<<m.damage<<endl;
cout<<"A: Attack("<<s001.attack<<")"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
cout<<"Monster's health-"<<s001.attack<<endl;
m.health-=s001.attack;
if(m.health<=0){
cout<<"Monster: ";
coutime("Oh!You win!\n",100);
cout<<"Monster dead.You award some money(money +"<<m.money<<")."<<endl;
s001.money+=m.money;
s001.health=HP;
flag[0][0]=1;
break;
}
cout<<"Monster attack you. Your's health-"<<m.attack<<endl;
s001.health-=m.attack;
}
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}else if(y==2&&flag[0][0]==1&&flag[0][1]==0){
int HP=s001.health;
cout<<"Monster1: ";
coutime("You kill my friends!I'll kill you back!\n",100);
cout<<s001.name+": ";
coutime("Err...\n",100);
cout<<"Monster2: ";
coutime("Me too!!!\n",100);
player m1={"Monster1 1-2",2,5,98,0,0.0},m2={"Monster2 1-2",2,10,1,0,0.0};
cout<<"Your fitness: "<<s001.health<<", "<<s001.attack<<", "<<s001.defense<<", "<<s001.damage<<endl;
cout<<"Monster1 fitness: "<<m1.health<<", "<<m1.attack<<", "<<m1.defense<<", "<<m1.damage<<endl;
cout<<"Monster2 fitness: "<<m2.health<<", "<<m2.attack<<", "<<m2.defense<<", "<<m2.damage<<endl;
cout<<"A: Attack Monster2("<<s001.attack<<")"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
cout<<"Monster2's health-"<<s001.attack<<endl;
m2.health-=s001.attack;
cout<<"Monster1 attack you. Your's health-"<<m1.attack<<endl;
s001.health-=m1.attack;
cout<<"Monster2 attack you. Your's health-"<<m2.attack<<endl;
s001.health-=m2.attack;
cout<<"Your fitness: "<<s001.health<<", "<<s001.attack<<", "<<s001.defense<<", "<<s001.damage<<endl;
cout<<"Monster1 fitness: "<<m1.health<<", "<<m1.attack<<", "<<m1.defense<<", "<<m1.damage<<endl;
cout<<"Monster2 fitness: "<<m2.health<<", "<<m2.attack<<", "<<m2.defense<<", "<<m2.damage<<endl;
cout<<s001.name+": ";
coutime("Oh No!I just have 1 health!What can I do?\n",100);
cout<<"???: ";
coutime("I can help you.\n",100);
cout<<s001.name+": ";
coutime("???\n",100);
cout<<"You obtain a Greater Health Potion."<<endl;
cout<<"A: Attack Monster1("<<s001.attack<<") and use the Greater Health Potion(99)"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
s001.health=HP;
cout<<"Monster1's health-"<<s001.attack<<endl;
cout<<"Monster1: ";
coutime("Noooo!!!\n",100);
cout<<"Monster1 dead.You award some money(money +"<<m1.money<<")."<<endl;
s001.money+=m1.money;
cout<<"Monster2: ";
coutime("No!!!You kill my another friend!I'll kill you, kill you!!!\n",100);
cout<<"Monster2's angry.His attack +9"<<endl;
m2.attack+=9;
cout<<"Your fitness: "<<s001.health<<", "<<s001.attack<<", "<<s001.defense<<", "<<s001.damage<<endl;
cout<<"Monster2 fitness: "<<m2.health<<", "<<m2.attack<<", "<<m2.defense<<", "<<m2.damage<<endl;
cout<<"Monster2 attack you. Your's health-"<<m2.attack<<endl;
s001.health-=m2.attack;
cout<<"A: Attack Monster2("<<s001.attack<<")"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
cout<<"Monster2's health-"<<s001.attack<<endl;
cout<<"Monster2: ";
coutime("Noooo!!!I haven't taken revenge yet!!!\n",100);
cout<<"Monster2 dead.You award some money(money +"<<m2.money<<")."<<endl;
s001.money+=m2.money;
s001.health=HP;
flag[0][1]=1;
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}else{
cout<<"You have completed/uncompleted that level, please choose another level."<<endl;
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}
}
}
}else{
cout<<"The function can't be found!"<<endl;
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}
}
}
记得点个赞
还有加团








有帮助,赞一个