标题:[求助]一个俄罗斯方块图形代码参考
只看楼主
sztonyyang
Rank: 1
等 级:新手上路
帖 子:106
专家分:0
注 册:2007-3-1
 问题点数:0 回复次数:3 
[求助]一个俄罗斯方块图形代码参考
小弟想用游戏来巩固记忆
当然现在没那能力因为我还在初学阶段,但是我想看看 图形代码的结构.
希望哪位 兄弟帮我做几个 俄罗斯方块形状代码出来我参考下 谢谢了!
搜索更多相关主题的帖子: 俄罗斯方块 图形代码 记忆 兄弟 
2007-03-04 00:34
neverTheSame
Rank: 3Rank: 3
来 自:江西农业大学
等 级:新手上路
威 望:9
帖 子:1511
专家分:0
注 册:2006-11-24
得分:0 

主要思路是:每个形状都可以是4个小方块
构成,每个形状都是4个小方块的组合.
void drawSimpleDiamond(int x,int y) /*画一个小方块*/
{
setfillstyle(1,7);
bar(x+1,y+1,x+24,y+24);
setlinestyle(0,0,1);
setcolor(15);
line(x,y,x+24,y);
line(x,y,x,y+24);
setcolor(8);
line(x+25,y,x+25,y+25);
line(x,y+25,x+24,y+25);
}

void stickGraph(int x,int y,int number) /*画横和竖两种形状*/
{
int i;
if(number==1)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x+78,y);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x,y+52);
drawSimpleDiamond(x,y+78);
return ;
}
}

void frameGraph(int x,int y) /*画田字形的方块*/
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x+26,y+26);
return ;
}

void pinGraph(int x,int y,int number) /*画凸字形的4种不同状态的方块*/
{
if(number==1)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x+26,y-26);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x,y+52);
drawSimpleDiamond(x+26,y+26);
return ;
}
else if(number==3)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x+26,y+26);
return ;
}
else if(number==4)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x,y+52);
drawSimpleDiamond(x-26,y+26);
return ;

}
}

void hoeGraph(int x,int y,int number) /*画7字形的4种不同状态的方块*/
{
if(number==1)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x,y+52);
drawSimpleDiamond(x+26,y);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x+52,y+26);
return ;
}
else if(number==3)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+26,y-52);
drawSimpleDiamond(x+26,y-26);
return ;
}
else if(number==4)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+52,y);
drawSimpleDiamond(x,y-26);
return ;
}
}

/*以下二个函数是画4种不同状态的梯形的函数*/

void stairsGraph1(int x,int y,int number)
{
if(number==1)
{
drawSimpleDiamond(x,y-26);
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+26,y+26);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+26,y-26);
drawSimpleDiamond(x+52,y-26);
return ;
}
}
void stairsGraph2(int x,int y,int number)
{
if(number==1)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x,y+26);
drawSimpleDiamond(x+26,y-26);
drawSimpleDiamond(x+26,y);
return ;
}
else if(number==2)
{
drawSimpleDiamond(x,y);
drawSimpleDiamond(x+26,y);
drawSimpleDiamond(x+26,y+26);
drawSimpleDiamond(x+52,y+26);
return ;
}
}


wap酷禾网(http://wap.),提供免费的、优质的、快捷的wap资源下载服务。
2007-03-04 18:27
sztonyyang
Rank: 1
等 级:新手上路
帖 子:106
专家分:0
注 册:2007-3-1
得分:0 

谢过楼上的兄弟


生活就是拼搏! C语言QQ群社:23644804
2007-03-05 13:57
ctzl20088
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-10-15
得分:0 
挺好的
2008-10-15 22:59



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-122453-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050999 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved