#include <yzkgame.h>
#pragma comment( linker, "/subsystem:\"console\" /entry:\"mainCRTStartup\"" )
#pragma comment(lib, "YZKGame.lib")
void gameMain(void)
{ int mario = 0;
int ch;
int x;
int y;
setGameTitle("王者");
setGameSize(800, 400);
createSprite(mario,"mario");
playSpriteAnimate(mario,"walk");
while (TRUE){
ch = getPressedKeyCode();
x = getSpriteX(mario);
y = getSpriteY(mario);
if (ch == RP_KEY_LEFT){
x = x - 1;
setSpritePosition(mario,x,y);
setSpriteFlipX(mario,FALSE);
pauseGame(10);
}
else if (ch == RP_KEY_RIGHT){
x++;
setSpritePosition(mario,x,y);
setSpriteFlipX(mario,TRUE);
pauseGame(10);
}
else if (ch == RP_KEY_UP)
{
y++;
setSpritePosition(mario,x,y);
setSpriteFlipX(mario,FALSE);
pauseGame(10);
}
else if (ch == RP_KEY_DOWN){
y--;
setSpritePosition(mario,x,y);
setSpriteFlipX(mario,TRUE);
pauseGame(10);
}
}
pauseGame(10000);
}
int main(void)
{
rpInit(gameMain);
return 0;
}
#pragma comment( linker, "/subsystem:\"console\" /entry:\"mainCRTStartup\"" )
#pragma comment(lib, "YZKGame.lib")
void gameMain(void)
{ int mario = 0;
int ch;
int x;
int y;
setGameTitle("王者");
setGameSize(800, 400);
createSprite(mario,"mario");
playSpriteAnimate(mario,"walk");
while (TRUE){
ch = getPressedKeyCode();
x = getSpriteX(mario);
y = getSpriteY(mario);
if (ch == RP_KEY_LEFT){
x = x - 1;
setSpritePosition(mario,x,y);
setSpriteFlipX(mario,FALSE);
pauseGame(10);
}
else if (ch == RP_KEY_RIGHT){
x++;
setSpritePosition(mario,x,y);
setSpriteFlipX(mario,TRUE);
pauseGame(10);
}
else if (ch == RP_KEY_UP)
{
y++;
setSpritePosition(mario,x,y);
setSpriteFlipX(mario,FALSE);
pauseGame(10);
}
else if (ch == RP_KEY_DOWN){
y--;
setSpritePosition(mario,x,y);
setSpriteFlipX(mario,TRUE);
pauseGame(10);
}
}
pauseGame(10000);
}
int main(void)
{
rpInit(gameMain);
return 0;
}