c语言超级玛丽的程序,c语言编程小游戏实现的超级玛丽游戏源码

编程知识 行业动态 更新时间:2024-06-13 00:21:51

int game::GetCommand()

{

int c = 0;

if (GetAsyncKeyState('A') & 0x8000)

c |= CMD_LEFT;

if (GetAsyncKeyState('D') & 0x8000)

c |= CMD_RIGHT;

if ((GetAsyncKeyState('W') & 0x8000)||(GetAsyncKeyState('K') & 0x8000))

c |= CMD_UP;

if (GetAsyncKeyState('S') & 0x8000)

c |= CMD_DOWN;

if (GetAsyncKeyState('J') & 0x8000)

c |= CMD_SHOOT;

if (GetAsyncKeyState(VK_ESCAPE) & 0x8000)

c |= CMD_ESC;

return c;

}

void game::left()

{

role.iframe*=-1;

role.turn=-1;

role.x-=STEP;

if(is_l_touch(1)==1)

role.x+=STEP;

if(role.x

role.x+=STEP;

}

void game::right()

{

role.iframe*=-1;

role.turn=1;

role.x+=STEP;

if(is_r_touch(1)==1)

role.x-=STEP;

if(role.x>role.xright&&(-xmap+role.x

{

role.x-=STEP;

xmapsky-=1;

xmap-=STEP;

}

}

void game::up()

{

mciSendString("play mymusic4 from 0", NULL, 0, NULL);

role.iframe*=-1;

v0=-sqrt(2*G*HIGH);

role.jump=1;

}

更多推荐

c语言超级玛丽的程序,c语言编程小游戏实现的超级玛丽游戏源码

本文发布于:2023-04-01 06:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/668ae18e6546c29fd2309b1838cc1568.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:玛丽   语言   小游戏   源码   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!