加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Arrow-3.h 18.94 KB
一键复制 编辑 原始数据 按行查看 历史
SadLava 提交于 2022-05-21 23:24 . 修复了若干bug
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
#define BULLETV getwidth() * 40 / 1920
#define MAXE SDATA.life[PLAYER] /* 能量值极限 */
/* 最大处理半径,超过该半径的敌机将被清除 */
#define HR (getwidth() * 4800.0 / 1920)
#define BR getwidth() * 100 / 1920 /* 爆炸半径 */
#define BT 10 /* 爆炸时长 */
#define LR (getwidth() * 2) /* 雷达侦测半径 */
/* 极限视距(用于绘制星星) */
#define MAXVL ('S' + 'A' + 'D' + 'L' + 'A' + 'V' + 'A')
#define ITEMZ 50 /* 玩家深度 */
#define STARMAXLIFE 200
#define STARMINLIFE 100
#define tranColor BLACK
#define MAXGRAINSNUM 50000
#define AISR getwidth()//AI搜索半径
#define BULLETFT 80.0 /* 弹舱回满时间 */
int STARNUM=0;//星辰数量,可通过关卡文件修改
color_t bkcolor;//背景色,可通过关卡文件修改
enum rolestype {
BAD_BULLET,
GOOD_BULLET,
SWORD,//追逐导弹
CLOUD,//实体云
CHECKPOINT,//检查点
LOVE,
PLANET,
NOYA,
SMALLGREEN,
MIDBLUE,
BIGPURPLE,
BASER,
PROCER,
SPEEDER,
RUINER,
LIGHTER,
STARD,
GOD,
END
};
enum buffstype {
ICEBLTS=1,//雪花弹,未实装
TRACKBLTS=1<<1,//追踪弹,未实装
MOREBLTS=1<<2,//散弹:把机体当前的子弹数*3,往原角度偏45度的方向发射,实装
POWERFULLBLTS=1<<3,//子弹增大&加伤,实装
STRONGER=1<<4,//双条与攻击提升,实装
SHEILD=1<<5,//更强的护盾,受伤后清除一小块地方的子弹,增强防御,实装
DRINKENERGY=1<<6,//增强杀怪恢复能量,实装
DRINKBLOOD=1<<7,//击杀回血,实装
HURTFORENERGY=1<<8,//受伤后按照一定比例恢复能量,实装
HURTFORPOWER=1<<9,//血量越低伤害越高,实装
};
//一些buff的数据
#define POWERFULBLTS_SCALE 1.5 //子弹强化buff强化系数
#define SHEILD_SCALE 1.5 //可以清理掉子弹的护盾系数(碰撞箱的若干倍)及护盾值提升量
#define STRONGER_SCALE 1.5//双条与攻击提升系数
#define DRINKENERGY_SCALE 1.5//吸收能量倍数
#define DRINKBLOOD_SCALE 0.5//每次伤害回血数
#define HURTFORENERGY_SCALE 1.0//能量:血量
#define HURTFORPOWER_SCALE 2.5//0血(达不到)时达到的伤害倍数,呈线性变化
enum userinfo {
SCORE,
PASS
};
vector<string> UNList; /* 用户名列表 */
vector<string> PASSList; /* 用户密码列表 */
float pX = 0, pY = 0, pR = 0, pS = 0, pF = 0; /* 玩家位置、角度、行驶距离、击落数量 */
int pBuffs=0;//玩家拥有的buff
long long scores = 0; /* 玩家积分 */
string name; /* 当前正在处理的玩家的名称 */
bool gPlanes[END]; /* 玩家所拥有的机型 */
float bGrade = 1; /* 玩家子弹伤害评级,顺序为D,C,B,A,S,SS,SSS,最高为8,1不显示 */
pair<int,int> s_grade; /* 玩家故事模式等级 */
vector<string> s_words; /* 故事模式对话 */
float s_weight = 1; /* 故事模式积分加权 */
int checkpointDist=0;//击落多少遇到一个检查点
int checkpointNum=0;//碰到了几个检查点(遇到一次怪数量变多,目前设计是*1.5)
int s_maxg=0;//当前章最大节数
string s_namec;//当前章节名
int s_maxc = 0; /* 故事模式最大章数 */
bool catchCheckpoint=0;
int PLAYER=NOYA; /* 玩家所用机型 */
#include "A_calc.h"
/* 成绩结构 */
struct grade {
int score; /* 积分 */
int falls; /* 击落数量 */
int lens; /* 飞行距离 */
int role; /* 使用角色 */
grade() {
score = 0;
falls = 0;
lens = 0;
role = 0;
}
};
/* 目标结构 */
class target {
public:
int len; /* 目标飞行距离 */
int falls; /* 目标总击落量 */
int fall[END]; /* 单种机型目标击落 */
target() {
len = 0;
falls = 0;
for ( int f : fall ) {
f = 0;
}
}
void reset() {
len = 0;
falls = 0;
for ( int f : fall ) {
f = 0;
}
}
};
target s_target; /* 故事模式目标 */
target p_target; /* 玩家的当前成绩 */
vector<grade> tops; /* 榜单 */
bool cmpGrade( grade a, grade b ) {
if ( a.score == b.score ) {
if ( a.falls == b.falls ) {
return(a.lens > b.lens);
} else return(a.falls >= b.falls);
} else return(a.score >= b.score);
}
#include "soundSystem.cpp"
#include "saveData.cpp"
inline void drawWay( int x, int y, float r, color_t c ) {
setcolor( c );
setlinewidth( 3 );
float X, Y;
J2DtoS2D( X, Y, r, getwidth() * 20 / 1920 );
line( x, y, x + X, y + Y );
J2DtoS2D( X, Y, r + PI / 2, getwidth() * 9 / 1920 );
line( x, y, x + X, y + Y );
J2DtoS2D( X, Y, r - PI / 2, getwidth() * 9 / 1920 );
line( x, y, x + X, y + Y );
}
inline void drawCross( int x, int y, color_t c ) {
setcolor( c );
setlinewidth( 3 );
line( x, y-getwidth() * 10 / 1920, x, y + getwidth() * 10 / 1920 );
line( x-getwidth() * 10 / 1920, y, x + getwidth() * 10 / 1920, y );
}
//切换页面
inline void changePos(bool silence=false) {
PIMAGE bmb = newimage();
setbkcolor( BLACK, bmb );
cleardevice( bmb );
ege_enable_aa( 1, bmb );
ege_gentexture( 1, bmb );
ege_setalpha( 127, bmb );
if(!silence) MSYS.change();
for ( int i = 0; i < 15; i += 1 ) {
ege_puttexture( bmb, 0, 0, getwidth(), getheight() );
delay_fps( 60 );
}
}
//毛玻璃
PIMAGE glass(PIMAGE t) {
int ax[]= {-1,0,1,-1,1,-1,0,1};
int ay[]= {-1,-1,-1,0,0,1,1,1};
PIMAGE f=newimage(getwidth(t),getheight(t));
PIMAGE ft=newimage(getwidth(t)-2,getheight(t)-2);
color_t c;
int r;
int xt,yt;
f=t;
for(int y=1; y<getheight(t)-1; y++) {
for(int x=1; x<getwidth(t)-1; x++) {
r=random(8);
xt=x+ax[r];
yt=y+ay[r];
c=getpixel(xt,yt,t);
putpixel(x-1,y-1,c,ft);
}
}
putimage(f,2,2,ft);
delimage(ft);
return f;
}
//输入框
//输入框标题,输入框内容,输入框默认内容,是否使用背景
string inputbox(string title="",string info="",string text="",int w=getwidth()/4,int h=getheight()/4,bool usebk=false) {
PIMAGE bk=newimage();
if(usebk) {
getimage(bk,0,0,getwidth(),getheight());
}
sys_edit edit;
char tc[1000];
int mw=getwidth()/2,mh=getheight()/2;
edit.create(0);
edit.move(mw-w/2+mw/60,mh+mh/60);
edit.size(w-mw/30,h/2-mh/30);
edit.settext(text.c_str());
edit.setfont(mh/15/3*2,0,"微软雅黑_Light");
edit.visable(1);
setfont(mh/15/3*2,0,"微软雅黑_Light");
setcolor(BLACK);
while(!::GetAsyncKeyState( VK_RETURN )) {
if(usebk) {
putimage(0,0,bk);
}
//画方格
setfillcolor(EGERGB(240,240,240));
bar(mw-w/2,mh-h/2,mw+w/2,mh+h/2);
setfillcolor(WHITE);
bar(mw-w/2,mh-h/2,mw+w/2,mh-h/2+mh/15);
//画线框
setlinewidth(1);
line(mw-w/2,mh-h/2,mw+w/2,mh-h/2);
line(mw-w/2,mh-h/2,mw-w/2,mh+h/2);
line(mw+w/2,mh+h/2,mw-w/2,mh+h/2);
line(mw+w/2,mh+h/2,mw+w/2,mh-h/2);
//显示字
outtextxy(mw-w/2+mh/150,mh-h/2+mh/45/2,title.c_str());
outtextrect(mw-w/2+mh/150,mh-h/2+mh/15,w-mh/150,mh+mh/60,info.c_str());
//画控件
edit.draw(NULL);
delay_fps(60);
cleardevice();
}
edit.gettext(1000,tc);
edit.destory();
return tc;
}
void summonGrains( int num, float x, float y, float r, float rf, float minV, float maxV, int minsize, int maxsize, int minlife, int maxlife, int alpha, bool rcolor = false, color_t color = WHITE );
/* 子弹 */
class bullet {
public:
/* 位置 */
float x;
float y;
float r; /* 角度 */
float R;//子弹半径
int type; /* 类型 */
float v; /* 速度 */
/* 增量 */
float dX, dY;
int life; /* 杀伤力 */
inline void draw() {
if(type==BAD_BULLET) {
setcolor( EGERGBA( 255, 0, 0 ,200) );
setfillcolor( EGERGBA( 255, 0, 0 ,200) );
ege_fillellipse(x + getwidth() / 2 - pX-SDATA.width[BAD_BULLET]*0.5,y + getheight() / 2 - pY-SDATA.height[BAD_BULLET]*0.5,SDATA.width[BAD_BULLET],SDATA.height[BAD_BULLET]);
setcolor( EGERGBA( 255, 255, 255 ,255) );
setfillcolor( EGERGBA( 255, 255, 255 ,255) );
ege_fillellipse(x + getwidth() / 2 - pX-SDATA.width[BAD_BULLET]*0.4,y + getheight() / 2 - pY-SDATA.height[BAD_BULLET]*0.4,SDATA.width[BAD_BULLET]*0.8,SDATA.height[BAD_BULLET]*0.8);
} else {
setcolor( EGERGBA( 0, 255, 255 ,200) );
setfillcolor( EGERGBA( 0, 255, 255 ,200) );
if(pBuffs&buffstype::POWERFULLBLTS)//处理buff
ege_fillellipse(x + getwidth() / 2 - pX-SDATA.width[GOOD_BULLET]*0.5*POWERFULBLTS_SCALE,y + getheight() / 2 - pY-SDATA.height[GOOD_BULLET]*0.5*POWERFULBLTS_SCALE,SDATA.width[GOOD_BULLET]*POWERFULBLTS_SCALE,SDATA.height[GOOD_BULLET]*POWERFULBLTS_SCALE);
else
ege_fillellipse(x + getwidth() / 2 - pX-SDATA.width[GOOD_BULLET]*0.5,y + getheight() / 2 - pY-SDATA.height[GOOD_BULLET]*0.5,SDATA.width[GOOD_BULLET],SDATA.height[GOOD_BULLET]);
setcolor( EGERGBA( 255, 255, 255 ,255) );
setfillcolor( EGERGBA( 255, 255, 255 ,255) );
if(pBuffs&buffstype::POWERFULLBLTS)//处理buff
ege_fillellipse(x + getwidth() / 2 - pX-SDATA.width[GOOD_BULLET]*0.4*POWERFULBLTS_SCALE,y + getheight() / 2 - pY-SDATA.height[GOOD_BULLET]*0.4*POWERFULBLTS_SCALE,SDATA.width[GOOD_BULLET]*0.8*POWERFULBLTS_SCALE,SDATA.height[GOOD_BULLET]*0.8*POWERFULBLTS_SCALE);
else
ege_fillellipse(x + getwidth() / 2 - pX-SDATA.width[GOOD_BULLET]*0.4,y + getheight() / 2 - pY-SDATA.height[GOOD_BULLET]*0.4,SDATA.width[GOOD_BULLET]*0.8,SDATA.height[GOOD_BULLET]*0.8);
}
}
};
vector<bullet> bullets; /* 子弹列表 */
/* 可自由运动的物体 */
class role {
public:
/*
* 通用
* 位置
*/
float x;
float y;
float r; /* 角度 */
UINT type; /* 类型 */
float v; /* 速度 */
int life; /* 生命 */
bool blasting;
UINT blaststep; /* 爆炸进度,最大等于爆炸半径+碰撞半径 */
float bulletC; /* 子弹发射冷却 */
bool death; /* 是否死亡 */
bool id; /* 判断是否为玩家,AI统一为0 */
/* 以下为玩家特有 */
float energy; /* 能量值 */
float hE; /* 用于处理的能量 */
bool protecting; /* 是否开启护盾/一技能 */
bool clearing; /* 是否开启大清扫/二技能 */
bool mV; /* 是否开启亚光速跳跃 */
/* 以下为AI特有 */
int AIState;
/* 以下为行星特有 */
int R; /* 半径 */
role() {
x = y = r = v = 0;
clearing = false;
death = false;
energy = 0;
blaststep = 0;
blasting = 0;
bulletC = 0;
protecting = 0;
mV = 0;
id = 0;
}
void reset() {
x = y = r = v = 0;
clearing = false;
death = false;
energy = 0;
blaststep = 0;
blasting = 0;
bulletC = 100;
protecting = 0;
mV = 0;
id = 0;
}
inline void move( bool fast = false ) {
float vL = 0;
if ( blasting )
return;
if ( clearing )
return;
float dx, dy;
if ( !mV ) {
if ( !fast ) {
vL = getwidth() * v / 1920;
} else {
if ( abs( v * 2 ) <= SDATA.maxV[type] ) {
vL = getwidth() * v * 2 / 1920;
} else {
if ( v > 0 )
vL = getwidth() * SDATA.maxV[type] / 1920;
else
vL = getwidth() * -1 * SDATA.maxV[type] / 1920;
}
}
} else {
vL = 0.5;//getwidth() * SDATA.maxV[type] * 3 / 1920;
}
J2DtoS2D( dx, dy, r, vL );
x += dx;
y += dy;
if ( id ) {
pS += abs( vL );
}
/* 创建粒子 */
if ( vL != 0 && !mV) {
summonGrains( 15, x, y, r + PI, 30 * PI / 180, 0, SDATA.height[type] * vL / SDATA.maxV[type] / 5, 15, 40, 1, 5, 0, false, EGECOLORA( EGERGB( 5, 164, 233 ), 127 ) );
summonGrains( 20, x, y, r + PI, 15 * PI / 180, 0, SDATA.height[type] * vL / SDATA.maxV[type] / 5, 5, 30, 1, 4, 0, false, EGECOLORA( EGERGB( 152, 217, 234 ), 127 ) );
} else if(mV) {
vL=getwidth() * SDATA.maxV[type] * 10 / 1920;
summonGrains( 15, x, y, r + PI, 30 * PI / 180, 0, SDATA.height[type] * vL / SDATA.maxV[type] / 5, 15, 40, 1, 5, 0, false, EGECOLORA( EGERGB( 5, 164, 233 ), 127 ) );
summonGrains( 20, x, y, r + PI, 15 * PI / 180, 0, SDATA.height[type] * vL / SDATA.maxV[type] / 5, 5, 30, 1, 4, 0, false, EGECOLORA( EGERGB( 152, 217, 234 ), 127 ) );
}
}
inline void addV() {
if ( blasting )
return;
if ( v < SDATA.maxV[type] )
v++;
summonGrains( 5, x, y, r + PI, 30 * PI / 180, 0, SDATA.height[type] * v / SDATA.maxV[type] / 5, 15, 40, 1, 5, 0, false, EGECOLORA( EGERGB( 5, 164, 233 ), 127 ) );
summonGrains( 10, x, y, r + PI, 15 * PI / 180, 0, SDATA.height[type] * v / SDATA.maxV[type] / 5, 5, 30, 1, 4, 0, false, EGECOLORA( EGERGB( 152, 217, 234 ), 127 ) );
}
inline void subV() {
if ( blasting )
return;
if ( v > -1 * SDATA.maxV[type] )
v--;
}
inline void turnL( bool fast = false ) {
if ( blasting )
return;
if ( clearing )
return;
if ( !fast ) {
r += PI / 180;
summonGrains( 15, x, y, r - PI / 4 * 3, 16 * PI / 180, 0, SDATA.width[type] / 2, 5, 10, 1, 5, 0, false, EGECOLORA( EGERGB( 5, 164, 233 ), 127 ) );
summonGrains( 20, x, y, r - PI / 4 * 3, 8 * PI / 180, 0, SDATA.width[type] / 2 - 10, 1, 6, 1, 4, 0, false, EGECOLORA( EGERGB( 152, 217, 234 ), 127 ) );
} else {
r += PI / 180 * 5;
summonGrains( 15, x, y, r - PI / 4 * 3, 16 * PI / 180, 0, SDATA.width[type], 5, 10, 1, 5, 0, false, EGECOLORA( EGERGB( 5, 164, 233 ), 127 ) );
summonGrains( 20, x, y, r - PI / 4 * 3, 8 * PI / 180, 0, SDATA.width[type] / 2 - 10, 1, 6, 1, 4, 0, false, EGECOLORA( EGERGB( 152, 217, 234 ), 127 ) );
}
}
inline void turnR( bool fast = false ) {
if ( blasting )
return;
if ( clearing )
return;
if ( !fast ) {
r -= PI / 180;
summonGrains( 15, x, y, r + PI / 4 * 3, 16 * PI / 180, 0, SDATA.width[type] / 2, 5, 10, 1, 5, 0, false, EGECOLORA( EGERGB( 5, 164, 233 ), 127 ) );
summonGrains( 20, x, y, r + PI / 4 * 3, 8 * PI / 180, 0, SDATA.width[type] / 2 - 10, 1, 6, 1, 4, 0, false, EGECOLORA( EGERGB( 152, 217, 234 ), 127 ) );
} else {
r -= PI / 180 * 5;
summonGrains( 15, x, y, r + PI / 4 * 3, 16 * PI / 180, 0, SDATA.width[type], 5, 10, 1, 5, 0, false, EGECOLORA( EGERGB( 5, 164, 233 ), 127 ) );
summonGrains( 20, x, y, r + PI / 4 * 3, 8 * PI / 180, 0, SDATA.width[type] / 2 - 10, 1, 6, 1, 4, 0, false, EGECOLORA( EGERGB( 152, 217, 234 ), 127 ) );
}
}
inline void shootBulletInADirection(float bulletR,bool fast) {
float tx, ty;
bullet b;
float bx1, by1, bx2, by2;
J2DtoS2D( bx1, by1, r - PI / 2, SDATA.width[type] / 2 );
J2DtoS2D( bx2, by2, r + PI / 2, SDATA.width[type] / SDATA.shootV[type] );
bx1 = x + bx1;
by1 = y + by1;
for ( int i = 0; i < SDATA.shootV[type]; i++ ) {
b.x = bx1 + i * bx2 + bx2 / 2;
b.y = by1 + i * by2 + by2 / 2;
b.r = bulletR;
if ( !mV ) {
if ( fast ) {
if ( abs( v * 2 ) <= SDATA.maxV[type] ) {
b.v = getwidth() * v * 2 / 1920 + BULLETV;
} else {
if ( v > 0 )
b.v = getwidth() * SDATA.maxV[type] / 1920 + BULLETV;
else
b.v = getwidth() * SDATA.maxV[type] / -1920 + BULLETV;
}
} else {
b.v = getwidth() * v / 1920 + BULLETV;
}
} else {
b.v = getwidth() * SDATA.maxV[type] * 3 / 1920 + BULLETV;
}
J2DtoS2D( tx, ty, b.r, b.v );
b.dX = tx;
b.dY = ty;
b.life = abs( b.v / 2 ) + SDATA.hurt[PLAYER];
if ( id )
b.life *= bGrade;
if ( type == PLAYER )
b.type = GOOD_BULLET;
else
b.type = BAD_BULLET;
b.x += b.dX;
b.y += b.dY;
bullets.push_back( b );
}
}
inline void addBullet( bool fast = false ) {
if ( blasting )
return;
if ( bulletC - 5 < 0 ) {
return;
}
bulletC -= 5;
shootBulletInADirection(this->r,fast);
//考虑散弹buff
if(pBuffs&buffstype::MOREBLTS) {
float ff=PI/8;
shootBulletInADirection(this->r-ff,fast);
shootBulletInADirection(this->r+ff,fast);
}
if ( id) {
if(bGrade-0.1*SDATA.shootV[type]>1 ) {
bGrade -= 0.1*SDATA.shootV[type];
} else {
bGrade=1;
}
}
MSYS.shoot();
}
/* 自动更新数据 */
inline void getnew() {
if ( bulletC < SDATA.BNum[type] * 5 ) {
bulletC += 1;
}
if(mV) {
this->energy -= (float)MAXE / 125; /* 默认250帧后消散 */
if ( this->energy <= 0 ) {
mV = 0;
hE = 0;
}
}
if ( id ) {
pX = x;
pY = y;
pR = r;
}
}
};
vector<role> roles; /* 飞行器列表 */
/* 武器 */
class gun {
public:
float x, y;
float r;
bool state;
int id; /* 1开始 */
int bulletC;
gun() {
state = 0;
bulletC = 0;
}
void addBullet( bool fast, role r ) {
if ( bulletC < 10 ) {
bulletC++;
return;
}
bulletC = 0;
float tx, ty;
bullet b;
for ( int i = 0; i < SDATA.shootV[r.type]; i++ ) {
b.x = x;
b.y = y;
b.r = this->r;
if ( !r.mV ) {
if ( fast ) {
if ( abs( r.v * 2 ) <= SDATA.maxV[r.type] ) {
b.v = getwidth() * r.v * 2 / 1920 + BULLETV;
} else {
if ( r.v > 0 )
b.v = getwidth() * SDATA.maxV[r.type] / 1920 + BULLETV;
else
b.v = getwidth() * SDATA.maxV[r.type] / -1920 + BULLETV;
}
} else {
b.v = getwidth() * r.v / 1920 + BULLETV;
}
} else {
b.v = getwidth() * SDATA.maxV[r.type] * 3 / 1920 + BULLETV;
}
J2DtoS2D( tx, ty, b.r, b.v );
b.dX = tx;
b.dY = ty;
b.life = abs( b.v / 2 ) + SDATA.hurt[r.type];
if ( r.type == PLAYER )
b.type = GOOD_BULLET;
else
b.type = BAD_BULLET;
b.x += b.dX;
b.y += b.dY;
bullets.push_back( b );
}
MSYS.shoot();
}
void setPos( role r ) {
switch ( r.type ) {
case RUINER: {
J2DtoS2D( x, y, r.r + id * 60 * PI / 180 + 30 * PI / 180, SDATA.cR[RUINER] );
x += r.x;
y += r.y;
state = 1;
break;
}
}
}
/* ruiner的自动防御效果 */
void autoPro( role r ) {
if ( r.type != RUINER )
return;
vector<float> ss;
float s;
int i = 0;
for ( role & t_r : roles ) {
s = (t_r.x - x) * (t_r.x - x) + (t_r.y - y) * (t_r.y - y);
ss.push_back( s );
i++;
}
if ( roles.size() == 0 )
return;
int minV = ss[0];
i = 0;
for ( int j = 0; j < ss.size(); j++ ) {
if ( ss[j] < minV ) {
i = j;
minV = ss[j];
}
}
role & tr = roles[i];
this->r = calcR( tr.x - x, tr.y - y ) + PI;
if ( bulletC < 50 ) {
bulletC++;
return;
}
bulletC = 0;
setlinewidth( 15 );
setcolor( GREEN );
line( x - pX + getwidth() / 2, y - pY + getheight() / 2, tr.x - pX + getwidth() / 2, tr.y - pY + getheight() / 2 );
setlinewidth( 6 );
setcolor( WHITE );
line( x - pX + getwidth() / 2, y - pY + getheight() / 2, tr.x - pX + getwidth() / 2, tr.y - pY + getheight() / 2 );
if ( tr.type == LOVE ) {
tr.blasting = 1;
r.life += tr.life;
MSYS.save();
} else tr.life -= SDATA.hurt[r.type];
MSYS.shoot();
}
};
vector<gun> guns; /* 武器列表 */
#include "grainSystem.cpp"
#include "runPoly.cpp"
#include "debug.cpp"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化