【易语言快速截图源码】【白酒一维码溯源码查询】【僵尸叔叔5资源码网盘】mathrandomc源码
1.çè±ä»£ç ç¼ç¨python(ç«ç°è±ä»£ç ç¼ç¨python)
2.俄罗斯方块的源代码?
çè±ä»£ç ç¼ç¨python(ç«ç°è±ä»£ç ç¼ç¨python)
æ¾çè±ç代ç
#-*-coding:utf-8-*-importmath,random,timeimportthreadingimporttkinterastkimportreuuidFireworks=[]maxFireworks=8height,width=,classfirework(object):def__init__(self,color,speed,width,height):=uuid.uuid1()self.radius=random.randint(2,4)~4åç´ self.color=colorself.speed=speed.5-3.5ç§self.status=0ï¼status=0ï¼çç¸åï¼status=1ï¼å½statusæ¶ï¼çè±ççå½æç»æ¢self.nParticle=random.randint(,)self.center=[random.randint(0,width-1),random.randint(0,height-1)]self.oneParticle=[]ï¼%ç¶ææ¶ï¼self.rotTheta=random.uniform(0,2*math.pi)ï¼x=a*cos(theta),y=b*sin(theta)=[a,b]
pythonç«é ·çè±è¡¨ç½æºä»£ç æ¯å¤å°ï¼å¦å®æ¬æç¨åï¼ä½ ä¹è½ååºè¿æ ·ççè±ç§ã
å¦ä¸å¾ç¤ºï¼æ们è¿ééè¿è®©ç»é¢ä¸ä¸ä¸ªç²ååè£ä¸ºXæ°éçç²åæ¥æ¨¡æçç¸ææãç²åä¼åçï¼è¨èâï¼æææ¯å®ä»¬ä¼ä»¥æé移å¨ä¸ç¸äºä¹é´çè§åº¦ç¸çãè¿æ ·å°±è½è®©æ们以ä¸ä¸ªåå¤è¨èçååå½¢å¼æ¨¡æåºçè±ç»½æ¾çç»é¢ã
ç»è¿ä¸å®æ¶é´åï¼ç²åä¼è¿å ¥ï¼èªç±è½ä½âé¶æ®µï¼ä¹å°±æ¯ç±äºéåå ç´ å®ä»¬å¼å§å è½å°å°é¢ï¼ä»¿è¥ç»½æ¾åççççè±ã
åºæ¬ç¥è¯ï¼ç¨PythonåTkinter设计çè±ã
è¿éä¸åä¸è¡èææ°å¦ç¥è¯å ¨ä¸¢åºæ¥ï¼æ们边å代ç 边说ç论ãé¦å ï¼ç¡®ä¿ä½ å®è£ åå¯¼å ¥äºTkinterï¼å®æ¯Pythonçæ åGUIåºï¼å¹¿æ³åºç¨äºåç§åæ ·ç项ç®åç¨åºå¼åï¼å¨Pythonä¸ä½¿ç¨Tkinterå¯ä»¥å¿«éçå建GUIåºç¨ç¨åºã
importtkinterastk
fromPILimportImage,ImageTk
fromtimeimporttime,sleep
fromrandomimportchoice,uniform,randint
frommathimportsin,cos,radians
é¤äºTkinterä¹å¤ï¼ä¸ºäºè½è®©çé¢ææ¼äº®çèæ¯ï¼æ们ä¹å¯¼å ¥PILç¨äºå¾åå¤çï¼ä»¥åå¯¼å ¥å ¶å®ä¸äºå ï¼æ¯å¦timeï¼randomåmathãå®ä»¬è½è®©æ们æ´å®¹æçæ§å¶çè±ç²åçè¿å¨è½¨è¿¹ã
Tkinteråºç¨çåºæ¬è®¾ç½®å¦ä¸ï¼
root=tk.Tk()
为äºè½åå§åTkinterï¼æä»¬å¿ é¡»å建ä¸ä¸ªTk()æ ¹é¨ä»¶ï¼rootwidgetï¼ï¼å®æ¯ä¸ä¸ªçªå£ï¼å¸¦ææ é¢æ åç±çªå£ç®¡çå¨æä¾çå ¶å®è£ 饰ç©ãè¯¥æ ¹é¨ä»¶å¿ é¡»å¨æ们åå»ºå ¶å®å°é¨ä»¶ä¹åå°±å建å®æ¯ï¼èä¸åªè½æä¸ä¸ªæ ¹é¨ä»¶ã
w=tk.Label(root,text="HelloTkinter!")
è¿ä¸è¡ä»£ç å å«äºLabelé¨ä»¶ã该Labelè°ç¨ä¸ç第ä¸ä¸ªåæ°å°±æ¯ç¶çªå£çååï¼å³æ们è¿éç¨çï¼æ ¹âãå ³é®ååæ°ï¼textâæææ¾ç¤ºçæåå 容ãä½ ä¹å¯ä»¥è°ç¨å ¶å®å°é¨ä»¶ï¼Buttonï¼Canvasççã
w.pack()
root.mainloop()
æ¥ä¸æ¥çè¿ä¸¤è¡ä»£ç å¾éè¦ãè¿éçæå æ¹æ³æ¯åè¯Tkinterè°æ´çªå£å¤§å°ä»¥éåºæç¨çå°é¨ä»¶ãçªå£ç´å°æ们è¿å ¥Tkinteräºä»¶å¾ªç¯ï¼è¢«root.mainloop()è°ç¨æ¶æä¼åºç°ãå¨æä»¬å ³éçªå£åï¼èæ¬ä¼ä¸ç´å¨åçå¨äºä»¶å¾ªç¯ã
å°çè±ç»½æ¾è½¬è¯æ代ç
ç°å¨æ们设计ä¸ä¸ªå¯¹è±¡ï¼è¡¨ç¤ºçè±äºä»¶ä¸çæ¯ä¸ªç²åãæ¯ä¸ªç²åé½ä¼æä¸äºéè¦çå±æ§ï¼æ¯é äºå®çå¤è§å移å¨ç¶åµï¼å¤§å°ï¼é¢è²ï¼ä½ç½®ï¼é度ççã
跨年çè±ä»£ç ï½ç¨Pythonéä½ ä¸åºè·¨å¹´çè±ç§å·²ç»æ¥è¿å°¾å£°äºï¼å³å°å°æ¥ï¼æ¬ææ们ç¨Pythonéä½ ä¸åºè·¨å¹´çè±ç§ã
æ们ç¨å°çPython模åå æ¬ï¼tkinterãPILãtimeãrandomãmathï¼å¦æ第ä¸æ¹æ¨¡å没æè£ çè¯ï¼pipinstallä¸ä¸å³å¯ï¼ä¸é¢çä¸ä¸ä»£ç å®ç°ã
导åº
çè±é¢è²
å®ä¹çè±ç±»
çæ¾çè±
å¯å¨
çä¸ä¸ææï¼
年跨年çè±ä»£ç å¯å¤å¶
çè±ä»£ç å¦ä¸ï¼
packagelove;
importjava.applet.Applet;
importjava.awt.Color;
importjava.awt.Graphics;
importjava.net.URL;
importjava.util.Random;
çè±
@authorenjoy
@SuppressWarnings("serial")
publicclassQextendsAppletimplementsRunnable
publicintspeed,variability,Max_Number,Max_Energy,Max_Patch,
Max_Length,G;
publicStringsound;
privateintwidth,height;
privateThreadthread=null;
privateBeaClassDemobcd[];
publicvoidinit()?
inti;
this.setSize(,);
width=getSize().width-1;
height=getSize().height-1;
speed=1;?//çè±ç»½æ¾çé度
variability=;
Max_Number=;?//å¯ååºçè±çæ大æ°ç®
Max_Energy=width+;
Max_Patch=;?//æ大çæç¹æ°
Max_Length=;?//æç¹çæ大è·ç¦»
G=;?//åå°é¢å¼¯æ²çå度
bcd=newBeaClassDemo[Max_Number];
for(i=0;iMax_Number;i++)
bcd[i]=newBeaClassDemo(width,height,G);
}
publicvoidstart(){
if(thread==null){
thread=newThread(this);
thread.start();
}
}
@SuppressWarnings("deprecation")
publicvoidstop(){
if(thread!=null){
thread.stop();
thread=null;
}
}
@SuppressWarnings({ "unused","static-access"})
publicvoidrun(){
inti;
intE=(int)(Math.random()*Max_Energy*3/4)+Max_Energy/4+1;
intP=(int)(Math.random()*Max_Patch*3/4)?//çè±çæç¹æ°
+Max_Patch/4+1;
intL=(int)(Math.random()*Max_Length*3/4)?//çè±å¯åå°åºçè·ç¦»
+Max_Length/4+1;
longS=(long)(Math.random()*);
booleansleep;
Graphicsg=getGraphics();
URLu=null;
while(true){
try{
thread.sleep(/speed);
catch(InterruptedExceptionx){
sleep=true;
for(i=0;iMax_Number;i++)
sleep=sleepbcd[i].sleep;
if(sleepMath.random()*variability){
E=(int)(Math.random()*Max_Energy*3/4)+Max_Energy/4
+1;
P=(int)(Math.random()*Max_Patch*3/4)+Max_Patch/4
+1;
L=(int)(Math.random()*Max_Length*3/4)+Max_Length/4
+1;
S=(long)(Math.random()*);
for(i=0;iMax_Number;i++){
if(bcd[i].sleepMath.random()*Max_Number*L1)
bcd[i].init(E,P,L,S);
bcd[i].start();
bcd[i].show(g);
publicvoidpaint(Graphicsg)?
g.setColor(Color.black);
g.fillRect(0,0,width+1,height+1);
classBeaClassDemo
publicbooleansleep=true;
privateintenergy,patch,length,width,height,G,Xx,Xy,Ex[],Ey[],x,
y,Red,Blue,Green,t;
privateRandomrandom;
publicBeaClassDemo(inta,intb,intg)
width=a;
height=b;
G=g;
publicvoidinit(inte,intp,intl,longseed)?
inti;
energy=e;
patch=p;
length=l;
//å建ä¸ä¸ªå¸¦ç§åçéæºæ°çæå¨
random=newRandom(seed);
Ex=newint[patch];
Ey=newint[patch];
Red=(int)(random.nextDouble()*)+;
Blue=(int)(random.nextDouble()*)+;
Green=(int)(random.nextDouble()*)+;
Xx=(int)(Math.random()*width/2)+width/4;
Xy=(int)(Math.random()*height/2)+height/4;
for(i=0;ipatch;i++){
Ex[i]=(int)(Math.random()*energy)-energy/2;
Ey[i]=(int)(Math.random()*energy*7/8)-energy/8;
publicvoidstart
t=0;
sleep=false;
publicvoidshow(Graphicsg)?
if(!sleep)
if(tlength)
inti,c;
doubles;
Colorcolor;
c=(int)(random.nextDouble()*)-+Red;
if(c=0c)
Red=c;
c=(int)(random.nextDouble()*)-+Blue;
if(c=0c)
Blue=c;
c=(int)(random.nextDouble()*)-+Green;
if(c=0c)
Green=c;
color=newColor(Red,Blue,Green);
for(i=0;ipatch;i++)
s=(double)t/;
x=(int)(Ex[i]*s);
y=(int)(Ey[i]*s-G*s*s);
g.setColor(color);
g.drawLine(Xx+x,Xy-y,Xx+x,Xy-y);
if(t=length/2)
intj;
for(j=0;j2;j++)
s=(double)((t-length/2)*2+j)/;
x=(int)(Ex[i]*s);
y=(int)(Ey[i]*s-G*s*s);
g.setColor(Color.black);
g.drawLine(Xx+x,Xy-y,Xx+x,Xy-y);
常ç¨çç¼ç¨è¯è¨ã
ç¼ç¨è¯è¨ä¸ï¼Cè¯è¨
Cè¯è¨æ¯ä¸çä¸ææµè¡ã使ç¨æ广æ³çé«çº§ç¨åºè®¾è®¡è¯è¨ä¹ä¸ãå¨æä½ç³»ç»åç³»ç»ä½¿ç¨ç¨åºä»¥åéè¦å¯¹ç¡¬ä»¶è¿è¡æä½çåºåï¼ç¨Cè¯è¨ææ¾ä¼äºå ¶å®é«çº§è¯è¨ï¼è®¸å¤å¤§ååºç¨è½¯ä»¶é½æ¯ç¨Cè¯è¨ç¼åçã
ç¼ç¨è¯è¨äº:java
Javaæ¯ä¸ç§å¯ä»¥æ°å跨平å°åºç¨è½¯ä»¶çé¢å对象çç¨åºè®¾è®¡è¯è¨ï¼æ¯ç±SunMicrosystemså ¬å¸äºå¹´5ææ¨åºçJavaç¨åºè®¾è®¡è¯è¨åJavaå¹³å°ï¼å³JavaSE,JavaEE,JavaMEï¼çæ»ç§°ã
ç¼ç¨è¯è¨ä¸:c++
C++è¿ä¸ªè¯å¨ä¸å½å¤§éçç¨åºåååä¸é常被读åâCå å âï¼è西æ¹çç¨åºåé常读åâCplusplus","CPPâãå®æ¯ä¸ç§ä½¿ç¨é常广æ³ç计ç®æºç¼ç¨è¯è¨ãC++æ¯ä¸ç§éææ°æ®ç±»åæ£æ¥çãæ¯æå¤éç¼ç¨èå¼çéç¨ç¨åºè®¾è®¡è¯è¨ã
俄罗斯方块的源代码?
#include <graphics.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
void draw_block(int x,int y,int style,int way);
void kill_line(int y);
void draw_little_block(int x,int y,int z,int style);
int check_block(int x,int y,int style);
int change(int *i,int *j,int key);
int style1,style,score,speed,l;
int board[][];
char str[];
struct shape
{
int xy[8],next;
};
struct shape shapes[]= /* 种方块(前
8个点表示4个小方块的相对位置 第9点表示类型) */
{
{
0,-2, 0,-1, 0, 0, 1, 0, 1
},
{ -1, 0, 0, 0, 1,-1, 1, 0, 2},
{ 0,-2, 1,-2, 1,-1, 1, 0, 3},
{ -1,-1,-1, 0, 0,-1, 1,-1, 0},
{ 0,-2, 0,-1, 0, 0, 1,-2, 5},
{ -1,-1, 0,-1, 1,-1, 1, 0, 6},
{ 0, 0, 1,-2, 1,-1, 1, 0, 7},
{ -1,-1,-1, 0, 0, 0, 1, 0, 4},
{ -1, 0, 0,-1, 0, 0, 1, 0, 9},
{ 0,-2, 0,-1, 0, 0, 1,-1,},
{ -1,-1, 0,-1, 1,-1, 0, 0,},
{ 0,-1, 1,-2, 1,-1, 1, 0, 8},
{ -1, 0, 0,-1, 0, 0, 1,-1,},
{ 0,-2, 0,-1, 1,-1, 1, 0,},
{ -1,-1, 0,-1, 0, 0, 1, 0,},
{ 0,-1, 0, 0, 1,-2, 1,-1,},
{ 0,-3, 0,-2, 0,-1, 0, 0,},
{ -1, 0, 0, 0, 1, 0, 2, 0,},
{ 0,-1, 0, 0, 1,-1, 1, 0,}
};
#define MAPXOFT 9 /* 第1个方块的位置 */
#define MAPYOFT 5
#define MAPXOFT1 /* 下一个方块的位置 */
#define MAPYOFT1
#define LEFT 0x4b
#define RIGHT 0x4d
#define DOWN 0x
#define UP 0x
#define ESC 0xb
#define ENTER 0x1c0d
int main()
{
int gdriver,gmode,
i,j,key,x0=5,y0=1,m,n,c,key1,p,q,le=0,b;
l=1,score=0;
gdriver=DETECT;
initgraph(&gdriver,&gmode,"D:\\TURBOC2");
randomize();
for(m=0;m<=;m++)
for(n=0;n<=;n++)
board[m][n]=0; /* 初始游戏版 */
setcolor(); /* 开机的画面 */
settextstyle(0,0,3);
outtextxy(,,"WELCOME TO RUSSIS");
outtextxy(,,"READY GO");
setcolor();
settextstyle
(0,0,4);
outtextxy(,,"^_^");
/
*circle(,,);
ellipse(,,,,,);
ellipse(,,,,,);
ellipse(,,,,,);*/
getch();
settextstyle(0,0,1);
cleardevice();
setcolor(LIGHTRED); /* 画出游戏所在的范围图
*/
setlinestyle(0,0,3);
setfillstyle(1,);
rectangle(,,,);
floodfill(,,LIGHTRED);
setcolor(LIGHTRED);
setlinestyle(0,0,3);
setfillstyle(1,);
rectangle(,,,);
floodfill(,,LIGHTRED);
setcolor(LIGHTRED);
setlinestyle(0,0,3);
setfillstyle(1,);
rectangle(,,,);
floodfill(,,LIGHTRED);
setcolor(LIGHTRED);
setlinestyle(0,0,1);
setfillstyle(1,BLUE);
rectangle(,,,);
floodfill(,,LIGHTRED);
setcolor();
for(m=0;m<=;m=m+2)
ellipse(,,0,,+m,+m);
setcolor();
setfillstyle(1,0);
circle(,,);
floodfill(,,);
outtextxy(,,"* you can change the game");
/* 对游戏的说明 */
outtextxy(,,"-speed and the gradth by"); /
*上为变形 左右 为 调整
下为快下 ESC为退出 */
outtextxy(,," using 'up'and'down'.");
outtextxy(,,"* when you are plying the");
outtextxy(,,"game,you can use these pu");
outtextxy(,,"-tturns.");
outtextxy(,,"* if you want to go into t");
outtextxy(,,"-he game,please 'enter'.");
outtextxy(,,"* you can chang shapes ");
outtextxy(,," using UP");
outtextxy(,,"* RIGHT and LEFT can" );
outtextxy(,," move shapes");
outtextxy(,,"GAMESPEED:");
outtextxy(,,"GRADTH:");
printf("\n\n\n 1");
printf("\n\n\n\n 0");
/* setcolor(LIGHTRED);
setlinestyle(0,0,1);
setfillstyle(1,);
rectangle(,,,);
floodfill(,,LIGHTRED); */
outtextxy(,,"SCORES:");
outtextxy(,,"**The speed will");
outtextxy(,,"increas if score");
outtextxy(,,"increas 3");
for(p=0;p<=;p++) /* 对速度的调整 */
{ key=bioskey(0);
if(key==ENTER)
break;
if(key==UP)
{
if(l==9)
l=9;
if(l<9)
l++;
}
if(key==DOWN)
{
if(l==1)
l=l;
if(l>1)
l--;
}
gotoxy(2,4);
printf("%d",l);
}
for(q=0;q<=;q++) /* 对高度的调整 */
{
key=bioskey(0);
if(key==ENTER)
break;
if(key==UP)
{
if(le==5)
le=le;
if(le<5)
le++;
}
if(key==DOWN)
{
if(le==0)
le=le;
if(le>0)
le--;
}
gotoxy(2,8);
printf("%d",le);
}
key=bioskey(0);
if(key==ENTER)
{
style=random();
for(m=1;m<=le;m++) /* 具体的对高度的调整 */
{
b=random(7)+1;
for(n=1;n<=;n++)
{
if(random(2))
{
board[n-1][-m]=1;
draw_little_block(MAPXOFT+n,MAPYOFT+-m,1,b);
}
}
}
while(1)
{
while(1)
{
i=x0,j=y0;
style1=random();
setcolor(); /* 画出下一个方
块 */
draw_block(MAPXOFT1,MAPYOFT1,style1,1);
for(j=y0;j<=;j++)
{
while(1)
{
if(bioskey(1)) /* 方块的
调整 */
{
key=bioskey(0);
change(&i,&j,key);
}
if(!check_block
(i,j+1,style)) /* 判断方块能不能下降 */
break;
if(j==)
break;
if(speed==1)
{
draw_block
(i,j,style,0); /* 方块的下降 */
j++;
draw_block
(i,j,style,1);
delay();
}
if(speed!=1)
{
m++;
delay
();
if(m>=3*(-l))
{
m=0;
draw_block
(i,j,style,0); /* 方块的下降 */
j++;
draw_block
(i,j,style,1);
}
}
}
speed=0;
for(m=0;m<=6;m+=2) /* 对有方块的位置给予1
的数值 */
board[i+shapes[style].xy[m]-1]
[j+shapes[style].xy[m+1]-1]=1;
if(board[ i][4]==1)
{
setcolor();
settextstyle(0,0,2);
outtextxy(,,"CAREFUL -_-");
delay();
delay();
setcolor(0);
outtextxy(,,"CAREFUL -_-");
settextstyle(0,0,1);
setcolor(LIGHTRED);
}
/* setcolor(LIGHTRED);
setlinestyle(0,0,1);
setfillstyle(1,);
rectangle(,,,);
floodfill(,,LIGHTRED);*/
if(l==1) /* 显示当前游戏等级 */
{
setcolor(LIGHTRED);
setlinestyle(0,0,1); /* 容易的速度 */
setfillstyle(1,);
rectangle(,,,);
floodfill(,,LIGHTRED);
outtextxy(7,," easy speed");
}
if(l==4)
{
setcolor(BLACK);
outtextxy(7,," easy speed");
setcolor(LIGHTRED); /* 中等难度 */
setlinestyle(0,0,1);
setfillstyle(1,);
rectangle(,,,);
floodfill(,,LIGHTRED);
outtextxy(7,," normal speed");
}
if(l==7)
{
setcolor(BLACK);
outtextxy(7,," normal speed");
setcolor(LIGHTRED);
setlinestyle(0,0,1); /* 困难的难度 */
setfillstyle(1,);
rectangle(,,,);
floodfill(,,LIGHTRED);
outtextxy(7,," hard speed");
}
kill_line(j);
if(j==)
break;
if(!check_block(i,j+1,style))
break;
}
draw_block(MAPXOFT1,MAPYOFT1,style1,0);
/* 对下1个方块显示位置进行覆盖 */
style=style1; /* 使的方块和显示的方块一样
*/
if(j==1) /* 关机的画面 */
{
setcolor();
settextstyle(0,0,2);
outtextxy(,,"GAME OVER");
outtextxy(,,"THANK YOU");
sleep(3);
exit(0);
}
}
}
}
getch();
}
int change(int *i,int *j,int key) /* 方块的具体的变化(
移动 变形 下降) */
{
if(key==UP&&check_block(*i,*j,shapes[style].next)) /
*变形 */
{
draw_block(*i,*j,style,0);
style=shapes[style].next;
draw_block(*i,*j,style,1);
}
else if(key==LEFT&&check_block(*i-1,*j,style)) /* 移动
*/
{
draw_block(*i,*j,style,0);
(*i)--;
draw_block(*i,*j,style,1);
}
else if(key==RIGHT&&check_block(*i+1,*j,style))
{
draw_block(*i,*j,style,0);
(*i)++;
draw_block(*i,*j,style,1);
}
else if(key==DOWN&&check_block(*i,*j+1,style)) /* 下降
*/
{
draw_block(*i,*j,style,0);
(*j)++;
draw_block(*i,*j,style,1);
speed=1;
}
else if(key==ESC) /* 退出 */
exit(0);
}
void draw_block(int x,int y,int style,int way) /* 画出方块
的位置 */
{
int x1=x+MAPXOFT,y1=y+MAPYOFT;
int i;
if(way==1)
{
setcolor(WHITE);
}
else
{
setcolor(BLACK);
}
for(i=0;i<=6;i+=2)
{
draw_little_block(x1+shapes[style].xy[
i],y1+shapes[style].xy[i+1],way,style);
}
}
void draw_little_block(int x,int y,int z,int style) /* 画
出方块的每一个小方块的形状(方块的色彩) */
{ int m,n;
if(z==1) /* 对色彩的调整 */
{
if(0<=style&&style<=3)
n=2;
if(4<=style&&style<=7)
n=3;
if(8<=style&&style<=)
n=4;
if(<=style&&style<=)
n=5;
if(<=style&&style<=)
n=6;
if(<=style&&style<=)
n=7;
if(style==)
n=8;
m=1;
}
if(z==0)
{
m=0,n=0;
}
setcolor(m);
setfillstyle(1,n);
rectangle(x*,y*,x*+,y*+);
floodfill(x*+2,y*+2,m);
}
void kill_line(int y) /* 消行 */
{
int i,t=1,j,k,color=random(7)+1;
for(;y>=1&&t<=4;y--,t++) /* 对4行进行验证 */
{
for(i=1;i<=;i++)
if(!board[i-1][y-1]) /* 严整1行的数组是不是全
为1 */
break;
if(i==)
{
setcolor(LIGHTRED); /* 对积分底色的画法
*/
setlinestyle(0,0,1);
setfillstyle(1,BLUE);
rectangle(,,,);
floodfill(,,LIGHTRED);
score++; /* 每消去1行 可以得1分 */
setcolor();
itoa(score,str,);
outtextxy(,,str);
if(score!=0&&score%3==0)
l++; /* 每次分到一定位置是 速度进
行提高(目前是3行加1次 可以调整) */
setcolor(); /* 每次消去是进行庆祝模式 */
settextstyle(0,0,4);
outtextxy(,,"COOL");
outtextxy(,,"^_^");
delay();
delay();
delay();
setcolor(BLACK);
settextstyle(0,0,4);
outtextxy(,,"COOL");
outtextxy(,,"^_^");
settextstyle(0,0,1);
if(score%3==0&&score!=0)
{
setcolor();
settextstyle(0,0,2);
outtextxy(,,"CONGRATULATION ON YOU ^_^");
sleep(2);
setcolor(BLACK);
settextstyle(0,0,2);
outtextxy(,,"CONGRATULATION ON YOU ^_^ ");
settextstyle(0,0,1);
}
for(k=1;k<=;k++) /* 对满了行进行消去
*/
{
setcolor(BLACK);
draw_little_block
(k+MAPXOFT,y+MAPYOFT,0,2);
}
for(j=y-1;j>=1;j--) /* 消去1行后 用上面的
累下来(并且调整色彩) */
for(k=1;k<=;k++)
{
board[k-1][j]=board[k-1][j-1];
if(board[k-1][j])
{
setcolor(BLACK);
draw_little_block
(k+MAPXOFT,j+MAPYOFT,0,2);
setcolor(WHITE);
draw_little_block
(k+MAPXOFT,j+1+MAPYOFT,1,color);
}
}
delay();
y++;
}
}
}
int check_block(int x,int y,int style) /* 验证能不能往下1
个位置累方块 */
{
int x1=x+MAPXOFT,y1=y+MAPYOFT;
int x2,y2,i;
for(i=0;i<=6;i+=2)
{
x2=x1+shapes[style].xy[ i];
y2=y1+shapes[style].xy[i+1];
if(x2>=&&x2<&&y2<&&(y2<6||board[x2-][y2-
6]==0))
continue;
else
break;
}
if(i==8)
return 1;
else
return 0;
getch();
}
我这里也是别人那里看来的。希望对你有用
易语言快速截图源码