#include"game1.h"
#include"algo.h"
int levelchose()
{
int quit = 0;
SDL_Event event ;
ShowPic("data/level.bmp",0,0);
while ( quit != 1 )
{
if ( SDL_PollEvent( & event ) )
{
if ( event .type == SDL_MOUSEMOTION)
{
Uint16 x = event .motion.x;
Uint16 y = event .motion.y;
if (x > 100 && x < 300 && y > 80 && y < 150 )
{
ShowPic("data/easy.bmp",0,0);
}
if (x > 40 && x < 360 && y > 200 && y < 260 )
{
ShowPic("data/normal.bmp",0,0);
}
if (x > 90 && x < 310 && y > 320 && y < 380 )
{
ShowPic("data/hard.bmp",0,0);
}
}
if ( event .type == SDL_MOUSEBUTTONDOWN)
{
Uint16 x = event .motion.x;
Uint16 y = event .motion.y;
if (x > 100 && x < 300 && y > 80 && y < 150 )
{
return 1;
}
if (x > 40 && x < 360 && y > 200 && y < 260 )
{
return 2;
}
if (x > 90 && x < 310 && y > 320 && y < 380 )
{
return 3;
}
}
if ( event .type == SDL_QUIT)
quit = 1 ;
}
if (SDL_Flip(screen) == - 1 )
{
return 0 ;
}
}
}
void RunGame()
{
SDL_Surface *cleanpic;
SDL_Delay(1000);
if ( gameround == 0 )
{
frame=1;
level=0;
chongzhi=3;
tishi=3;
settime=500;
timenum=125;
}
if ( gameround == 3 )
{
frame=1;
level=0;
settime=500;
timenum=125;
chongzhi=3;
tishi=3;
}
if ( gameround == 6 )
{
frame=0;
level=1;
settime=500;
timenum=125;
chongzhi=3;
tishi=3;
}
if ( gameround == 7 )
level=2;
if ( gameround == 8 )
level=3;
if ( gameround == 9 )
level=4;
if ( gamelevel == 1 )
{
InitPiclevel1();
showtimer();
}
if ( gamelevel == 2 )
{
InitPiclevel2();
showtimer();
}
if ( gamelevel == 3 )
{
InitPiclevel3();
showtimer();
}
// AmnArg test1(0, 250, 600, 250, screen);
// SDL_Thread* thread1 = SDL_CreateThread(amn, (void*)&test1);
int starttime = SDL_GetTicks();
SDL_Event event ;
int quit = 0 ;
int mclear = 0 ;
int np = 0 ;
int x1,y1,x2,y2 ;
int num1,num2 ;
int pause = 0 ;
int gameover = 0 ;
ntime=time(0);
while ( quit != 1 )
{
if ( settime==0 )
{
ShowPic("data/game_over.bmp",0,0);
}
if ( ntime!=time(0) )
{
settime--;
if ( settime%2 ==0 )
{
ClearTime();
timenum--;
}
ntime=time(0);
}
if ( SDL_PollEvent( & event ) )
{
if ( event .type == SDL_MOUSEBUTTONDOWN)
{
Uint16 x = event .motion.x;
Uint16 y = event .motion.y;
if ( event .button.button == SDL_BUTTON_LEFT)
{
if ( tishi>0 && x > 125 && x < 155 && y > 5 && y < 35 )
{
tishi--;
hint();
}
if (chongzhi>0 && x > 45 && x < 75 && y > 5 && y < 35 )
{
chongzhi--;
reinit();
}
if (x > 40 && x < 600 && y > 40 && y < 440 )
{
np++;
if ( np==1 )
{
num1=x/40-1+14*(y/40-1);
if( PPoint[num1].type!=0 )
{
x1=x/40;
y1=y/40;
char sz[10];
char name[10]="data/";
sprintf(sz, "%d", PPoint[num1].type);
strcat(sz,"c");
strcat(name,sz);
strcat(name,".bmp");
ShowPic(name,x1*40,y1*40);
}
}
if ( np==2 )
{
num2=x/40-1+14*(y/40-1);
if( PPoint[num2].type!=0 )
{
alpoint p1,p2;
p1.x=num1/14;
p1.y=num1%14;
p2.x=num2/14;
p2.y=num2%14;
mclear=algo_can_link( p1,p2 );
}
if( mclear == 1 && PPoint[num2].type!=0 )
{
x2=x/40;
y2=y/40;
char sz[10];
char name[10]="data/";
sprintf(sz, "%d", PPoint[num2].type);
strcat(sz,"c");
strcat(name,sz);
strcat(name,".bmp");
ShowPic(name,x2*40,y2*40);
DrawLine(num1,num2);
SDL_Delay(250);
}
}
np=np%2;
if( np==0 && mclear == 0 && PPoint[num2].type!=0 )
{
char sz[10];
char name[10]="data/";
sprintf(sz, "%d", PPoint[num1].type);
strcat(name,sz);
strcat(name,".bmp");
ShowPic(name,x1*40,y1*40);
}
if( np==0 && mclear == 1 )
{
ClearPic(num1) ;
ClearPic(num2) ;
mclear = 0 ;
//////////////////////////////////
if ( gamelevel==3 )
repaint();
/////////////////////////
score=score+100;
showscore();
}
int gnum = 0 ;
int i;
for(i=0;i<140;i++)
{
if ( PPoint[i].type == 0)
gnum++;
}
if ( gnum==140 )
{
gameround++;
if ( gameround < 9 )
{
if ( gameround == 3 )
{
gamelevel = 2 ;
score=score+settime*10;
showscore();
}
if ( gameround == 6 )
{
gamelevel = 3 ;
score=score+settime*10;
showscore();
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
操作系统时间linux视频游戏 (173个子文件)
p4.bmp 900KB
game_over.bmp 900KB
p5.bmp 900KB
start.bmp 900KB
harddi1.bmp 900KB
hard.bmp 900KB
goodbye.bmp 900KB
level.bmp 900KB
normal.bmp 900KB
p6.bmp 900KB
easy.bmp 900KB
normaldi1.bmp 900KB
p3.bmp 900KB
easydi1.bmp 900KB
di.bmp 900KB
congratulations.bmp 900KB
p2.bmp 900KB
s.bmp 900KB
p1.bmp 900KB
p5.bmp 900KB
p4.bmp 900KB
p6.bmp 900KB
p2.bmp 900KB
p1.bmp 900KB
p3.bmp 900KB
normalpause.bmp 656KB
easypause.bmp 656KB
hardpause.bmp 656KB
pause.bmp 656KB
24c.bmp 6KB
22c.bmp 6KB
23c.bmp 6KB
6c.bmp 5KB
5.bmp 5KB
12.bmp 5KB
4c.bmp 5KB
11c.bmp 5KB
13c.bmp 5KB
6.bmp 5KB
20c.bmp 5KB
21c.bmp 5KB
11.bmp 5KB
14c.bmp 5KB
10.bmp 5KB
15c.bmp 5KB
12c.bmp 5KB
19c.bmp 5KB
5c.bmp 5KB
10c.bmp 5KB
13.bmp 5KB
4.bmp 5KB
15.bmp 5KB
14.bmp 5KB
20.bmp 5KB
19.bmp 5KB
21.bmp 5KB
14c.bmp 5KB
30.bmp 5KB
8.bmp 5KB
3.bmp 5KB
13c.bmp 5KB
5c.bmp 5KB
7c.bmp 5KB
2.bmp 5KB
25.bmp 5KB
22.bmp 5KB
15c.bmp 5KB
2c.bmp 5KB
3c.bmp 5KB
16.bmp 5KB
9c.bmp 5KB
11.bmp 5KB
25c.bmp 5KB
9.bmp 5KB
19.bmp 5KB
7.bmp 5KB
21c.bmp 5KB
21.bmp 5KB
28.bmp 5KB
1c.bmp 5KB
17.bmp 5KB
18.bmp 5KB
17c.bmp 5KB
27c.bmp 5KB
29c.bmp 5KB
4c.bmp 5KB
30c.bmp 5KB
16c.bmp 5KB
23.bmp 5KB
23c.bmp 5KB
19c.bmp 5KB
28c.bmp 5KB
20c.bmp 5KB
15.bmp 5KB
29.bmp 5KB
14.bmp 5KB
24.bmp 5KB
10.bmp 5KB
6c.bmp 5KB
26c.bmp 5KB
共 173 条
- 1
- 2
资源评论
- u0106597952013-06-21还好,帮助我们解决了问题
- doudingchenlei2014-01-19en ,很简单的小游戏,有用
Janesname
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功