- 前言
- 写代码
- 下期预告
之前我们写了我的世界的方块的定义、食物的定义和世界的定义(当然,小编还是用之前写的,可以看看这一篇),今天我们来写工具的代码。
写代码我们首先定义一个结构体:
struct tools{
};
然后给这个工具命名
struct tools{
string name;
};
不要忘记工具类型和附魔
struct tool{
string name;
int fumo;//附魔
int lei;//工具类型
};
攻击伤害不能忘,当然还有耐久
struct tool{
string name;
int fumo;//附魔
int lei;//工具类型
int brek_hart//攻击伤害
long long naiQ//耐久
};
加上一个
tools[100];
就是
struct tool{
string name;
int fumo;//附魔
int lei;//工具类型
int brek_hart//攻击伤害
long long naiQ//耐久
}tools[100];
最后,我们的总程序变成了
#include下期预告using namespace std; struct worldx{ struct worldy{ int z_block1[510]; int z_block2[510]; double z_high[510]; short z_light[510]; }y[400]; }world1[510],world2[510],world3[510]; struct Food { unsigned short bake_fool=0; unsigned short bake_hart=0; string En,Cn; bool can_cook=0; int th1,th2,th3,th4,th5,th6,th7,th8,th9; }M_food[1000]; struct Blocks{ int thing1,thing2,thing3,thing4,thing5,thing6,thing7,thing8,thing9;//合成表 unsigned light=0;//光 string En,Cn;//名字 unsigned int fall=1;//掉落(模组) bool xushi=1,gwxushi=1;//虚实 bool fall=0;//是否掉落 double high=1;//高度 unsigned get_tool=0;//工具 unsigned fumo_tool=0;//附魔(不需要==0) double get_time=0;//获取时间 short bake_jump;//类粘液块方块 unsigned fangxiang=0;//放置方向 }block1[100000],block2[10000],block3[5000];//主世界、下界、末地 struct tool{ string name; int fumo;//附魔 int lei;//工具类型 int brek_hart//攻击伤害 long long naiQ//耐久 }tools[100];
你们肯定看烦了定义吧,下期,小编将带大家写一写有趣的指令。
好了,这期就到这里了,我们下期再见。



