游戏开发日志3
2025-12-13 00:18:05
发布于:香港
接上回
更新版本:1.0.2
代码:李伙子ia
美术:也没美术啊
翻译:Artificial Intelligence
更新了1-3:
else if(y==3&&flag[0][0]==1&&flag[0][1]==1&&flag[0][2]==0){
int HP=s001.health;
cout<<"Mysterious Merchant: ";
coutime("Do you want to buy some things?\n",100);
cout<<"A: Yes, B: No"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
int isbuy=1;
if(choice=="B"){
cout<<"Mysterious Merchant: ";
coutime("What a bummer!",100);
isbuy=0;
}else{
cout<<"Mysterious Merchant: ";
coutime("You can buy this:\n",100);
Sleep(500);
cout<<"A: Leather armor(Selling price: $5, Defense: +2"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
s001.money-=5;
cout<<"Purchase successful!Your current money amount is $"<<s001.money<<"."<<endl;
cout<<"Your defense +1."<<endl;
s001.defense++;
cout<<"Mysterious Merchant: ";
coutime("Have a good luck!\n",100);
}
cout<<"Monster: ";
coutime("I'm 'definitely not placed' in this level by the author(Li Huozi IA).\n",100);
cout<<s001.name+": ";
coutime("...\n",100);
player m={"Monster 1-3",2,10,2,0,0.0};
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;
cout<<"Monster attack you. Your's health-"<<m.attack-s001.defense<<endl;
s001.health-=m.attack-s001.defense;
cout<<(isbuy==1?"Equipment can mitigate some damage.":"")<<endl;
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;
cout<<"Monster: ";
coutime("I got set up by the author.Wuwuwu~\n",100);
cout<<"Monster dead.You award some money(money +"<<m.money<<")."<<endl;
s001.money+=m.money;
s001.health=HP;
flag[0][2]=1;
cout<<"Congratulation on completing the tutorial!!!"<<endl;
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}
更新了装备界面:
else if(choice=="equipment"){
cout<<"Your helmet, armor, leguard, and sabaton:"<<D.helmet<<", "<<D.armor<<", "<<D.leguard<<", "<<D.sabaton<<endl;
cout<<"Input to continue...";
char key;
cin>>key;
system("cls");
continue;
}
就没有了
几天前要上学,没时间更新
成品:
#include<iostream>
#include<string>
#include<windows.h>
#define endl '\n'
using std::string;
/*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++){
std::cout<<out[i];
Sleep(tIm);
}
}
int main(){
using std::cin;
using std::cout;
player s001;
string choice;
int flag[1][3]={{0,0,0}};
cout<<"The Newbie's Journey Log"<<endl;
cout<<"Version: 1.0.2"<<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.2"<<endl;
cout<<(flag[0][2]==1?"Author: Li Huozi IA":"");
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, version 1.0.2 semi-open)"<<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=="equipment"){
cout<<"Your helmet, armor, leguard, and sabaton:"<<D.helmet<<", "<<D.armor<<", "<<D.leguard<<", "<<D.sabaton<<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, 1-3"<<endl;
cout<<"Please choose a level(x-y): ";
int x,y;
cin>>x>>y;
if(x>1||y>3){
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 if(y==3&&flag[0][0]==1&&flag[0][1]==1&&flag[0][2]==0){
int HP=s001.health;
cout<<"Mysterious Merchant: ";
coutime("Do you want to buy some things?\n",100);
cout<<"A: Yes, B: No"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
int isbuy=1;
if(choice=="B"){
cout<<"Mysterious Merchant: ";
coutime("What a bummer!",100);
isbuy=0;
}else{
cout<<"Mysterious Merchant: ";
coutime("You can buy this:\n",100);
Sleep(500);
cout<<"A: Leather armor(Selling price: $5, Defense: +2"<<endl;
cout<<"Please choose your choice: ";
cin>>choice;
s001.money-=5;
cout<<"Purchase successful!Your current money amount is $"<<s001.money<<"."<<endl;
cout<<"Your defense +1."<<endl;
s001.defense++;
cout<<"Mysterious Merchant: ";
coutime("Have a good luck!\n",100);
}
cout<<"Monster: ";
coutime("I'm 'definitely not placed' in this level by the author(Li Huozi IA).\n",100);
cout<<s001.name+": ";
coutime("...\n",100);
player m={"Monster 1-3",2,10,2,0,0.0};
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;
cout<<"Monster attack you. Your's health-"<<m.attack-s001.defense<<endl;
s001.health-=m.attack-s001.defense;
cout<<(isbuy==1?"Equipment can mitigate some damage.":"")<<endl;
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;
cout<<"Monster: ";
coutime("I got set up by the author.Wuwuwu~\n",100);
cout<<"Monster dead.You award some money(money +"<<m.money<<")."<<endl;
s001.money+=m.money;
s001.health=HP;
flag[0][2]=1;
cout<<"Congratulation on completing the tutorial!!!"<<endl;
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;
}
}
}
细心的人已经发现我把using namespace std;
替换成一个个using std::了
最后一定要点个赞!
全部评论 2
真厉害啊!
昨天 来自 上海
1你也可以的,加油!
昨天 来自 香港
0我自己整不出来的

昨天 来自 上海
0你可以改篇啊,别全抄和发布就行。
昨天 来自 香港
0
#include<bits/stdc++.h> using namespace std; int main(){ cout<<"这是一条不规范的代码"<<endl; return 0;//重灾区 }2天前 来自 香港
0














有帮助,赞一个