2 Star 0 Fork 0

SadLava/Arrow3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
input.cpp 2.90 KB
一键复制 编辑 原始数据 按行查看 历史
SadLava 提交于 2022-05-08 17:08 . first update
inline void InputKey(role& player)
{
/* */
if ( ::GetAsyncKeyState( 'J' ) ) {
player.addBullet( ::GetAsyncKeyState( VK_LCONTROL ) );
}
if ( ::GetAsyncKeyState( 'A' ) && !::GetAsyncKeyState( 'I' ) || ::GetAsyncKeyState( VK_LEFT ) && !::GetAsyncKeyState( 'I' ) ) {
player.turnL( ::GetAsyncKeyState( VK_LCONTROL ) );
} else if ( ::GetAsyncKeyState( 'A' ) && ::GetAsyncKeyState( 'I' ) || ::GetAsyncKeyState( VK_LEFT ) && ::GetAsyncKeyState( 'I' ) ) {
for ( int i = 0; i < 90; i += 5 ) {
player.r += PI / 180 * 5;
pR = player.r;
runGrain();
drawGame( player );
imagefilter_blurring( NULL, 0xFF, 0x100 );
delay_fps( 60 );
}
}
if ( ::GetAsyncKeyState( 'D' ) && !::GetAsyncKeyState( 'I' ) || ::GetAsyncKeyState( VK_RIGHT ) && !::GetAsyncKeyState( 'I' ) ) {
player.turnR( ::GetAsyncKeyState( VK_LCONTROL ) );
} else if ( ::GetAsyncKeyState( 'D' ) && ::GetAsyncKeyState( 'I' ) || ::GetAsyncKeyState( VK_RIGHT ) && ::GetAsyncKeyState( 'I' ) ) {
for ( int i = 0; i < 90; i += 5 ) {
player.r -= PI / 180 * 5;
pR = player.r;
runGrain();
drawGame( player );
imagefilter_blurring( NULL, 0xFF, 0x100 );
delay_fps( 60 );
}
}
if ( ::GetAsyncKeyState( 'W' ) || ::GetAsyncKeyState( VK_UP ) ) {
player.addV();
}
if ( ::GetAsyncKeyState( 'S' ) && !::GetAsyncKeyState( 'I' ) || ::GetAsyncKeyState( VK_DOWN ) && !::GetAsyncKeyState( 'I' ) ) {
player.subV();
player.mV = 0;
} else if ( ::GetAsyncKeyState( 'S' ) && ::GetAsyncKeyState( 'I' ) || ::GetAsyncKeyState( VK_DOWN ) && ::GetAsyncKeyState( 'I' ) ) {
for ( int i = 0; i < 180; i += 5 ) {
player.r -= PI / 180 * 5;
pR = player.r;
runGrain();
drawGame( player );
imagefilter_blurring( NULL, 0xFF, 0x100 );
delay_fps( 60 );
}
}
if ( ::GetAsyncKeyState( '1' ) && PLAYER != NOYA ) {
if ( player.energy > 0 ) {
player.protecting = 1;
player.hE = player.energy;
}
} else if ( ::GetAsyncKeyState( '2' ) && PLAYER != NOYA ) {
if ( player.energy >= MAXE / 2 && !player.clearing ) {
player.clearing = 1;
player.hE = player.energy;
MSYS.pBlast();
}
bullets.clear();
} else if ( ::GetAsyncKeyState( 'F' ) && PLAYER != NOYA ) {
if(player.type != SPEEDER && player.energy==MAXE) {
player.protecting = 0;
player.mV = 1;
player.hE = player.life;
} else if ( player.type == SPEEDER && player.energy > 0 ) {
player.protecting = 0;
player.mV = 1;
player.hE = player.life;
}
} else if ( ::GetAsyncKeyState( 'O' ) ) {
float rA=pR;
for(float i=rA; i<rA+2*PI; i+=(float)2*PI/(player.bulletC/5)) {
player.r=i;
player.addBullet( 1 );
player.getnew();
runGrain();
drawGame( player );
imagefilter_blurring( NULL, 0xFF, 0x100 );
delay_fps( 60 );
}
player.r=rA;
player.getnew();
}
if ( ::GetAsyncKeyState( 'Q' ) ) {
// MSYS.Silence();
}
if ( player.energy < 0 )
player.energy = 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sadlava/arrow3.git
git@gitee.com:sadlava/arrow3.git
sadlava
arrow3
Arrow3
master

搜索帮助