- 注册时间
- 2004-11-20
- 最后登录
- 1970-1-1
|
问题具体描述如下:
我记得原来FantasyDR大哥教过我怎么滚屏地图,是吧,我也学会了,按照他说的那种方法,滚屏地图实现了,现在, 我把滚屏地图做到了游戏中,但是,却出现了很大的问题,我的程序在电脑上运行是绝对正常的,显示很正常,但是,我一下载到文曲星里,上下滚屏地图还不很明显,但是一遇到左右滚屏地图,屏幕上就闪烁的厉害,好像是乱码类的东西,这种情况在模拟器上运行的时候从来没有发现过,但是,在文曲星上很严重,我给大家看看代码,大家帮我看看,谢谢大家了~!
滚屏代码:
void MoveMap()
{
int a,b,t,k,f;
int dtime;
dtime=40;
f=0;
ClearScreen();
for(a=0;a<5;a++)
{
for(b=0;b<10;b++)
{
WriteBlock(b*16,a*16,16,16,1,map_su[map[ishuju[4]+a][ishuju[5]+b]]);
}
}
GetBlock(0,0,160,80,0,allscr);
ClearScreen();
if(ishuju[9]<3)
{
for(t=0;t<10;t++)
{
if(ishuju[9]==1)
{
WriteBlock(t*16,0,16,16,1,map_su[map[ishuju[4]-1][ishuju[5]+t]]);
GetBlock(0,0,80,16,0,bufscr);
}
if(ishuju[9]==2)
{
WriteBlock(t*16,0,16,16,1,map_su[map[ishuju[4]+5][ishuju[5]+t]]);
GetBlock(0,0,80,16,0,bufscr);
}
}
}
else
{
for(t=0;t<5;t++)
{
if(ishuju[9]==3)
{
WriteBlock(0,t*16,16,16,1,map_su[map[ishuju[4]+t][ishuju[5]-1]]);
GetBlock(0,0,16,160,0,bufscr);
}
if(ishuju[9]==4)
{
WriteBlock(0,t*16,16,16,1,map_su[map[ishuju[4]+t][ishuju[5]+10]]);
GetBlock(0,0,16,160,0,bufscr);
}
}
}
ClearScreen();
ClearScreen();
if(ishuju[9]==1)//当人物向上时
{
for(k=0;k<17;k=k+4)
{
ClearScreen();
WriteBlock(0,k,160,80,1,allscr);
WriteBlock(0,k-16,160,16,1,bufscr);
if(f==3 || f==4)
{
fseek(picopen,8384+((ishuju[3]-1)*384),0);
fread(herobody,1,32,picopen);
fseek(picopen,9152+((ishuju[3]-1)*768),0);
fread(herocover,1,32,picopen);
}
else
{
fseek(picopen,8384+((ishuju[3]-1)*384)+(f*32)+((ishuju[9]-1)*96),0);
fread(herobody,1,32,picopen);
fseek(picopen,9152+((ishuju[3]-1)*768)+(f*32)+((ishuju[9]-1)*96),0);
fread(herocover,1,32,picopen);
}
WriteBlock(ishuju[6]*16,ishuju[7]*16,16,16,4,herocover);
WriteBlock(ishuju[6]*16,ishuju[7]*16,16,16,3,herobody);
Refresh();
f=f+1;
Delay(dtime);
}
}
if(ishuju[9]==2)//当人物向下时
{
for(k=0;k>-17;k=k-4)
{
ClearScreen();
WriteBlock(0,k,160,80,1,allscr);
WriteBlock(0,k+80,160,16,1,bufscr);
if(f==3 || f==4)
{
fseek(picopen,8384+((ishuju[3]-1)*384+96),0);
fread(herobody,1,32,picopen);
fseek(picopen,9152+((ishuju[3]-1)*768+96),0);
fread(herocover,1,32,picopen);
}
else
{
fseek(picopen,8384+((ishuju[3]-1)*384)+(f*32)+((ishuju[9]-1)*96),0);
fread(herobody,1,32,picopen);
fseek(picopen,9152+((ishuju[3]-1)*768)+(f*32)+((ishuju[9]-1)*96),0);
fread(herocover,1,32,picopen);
}
WriteBlock(ishuju[6]*16,ishuju[7]*16,16,16,4,herocover);
WriteBlock(ishuju[6]*16,ishuju[7]*16,16,16,3,herobody);
Refresh();
f=f+1;
Delay(dtime);
}
}
if(ishuju[9]==3)//当人物向左时
{
for(k=0;k<17;k=k+4)
{
ClearScreen();
WriteBlock(k,0,160,80,1,allscr);
WriteBlock(k-16,0,16,80,1,bufscr);
if(f==3 || f==4)
{
fseek(picopen,8384+((ishuju[3]-1)*384+192),0);
fread(herobody,1,32,picopen);
fseek(picopen,9152+((ishuju[3]-1)*768+192),0);
fread(herocover,1,32,picopen);
}
else
{
fseek(picopen,8384+((ishuju[3]-1)*384)+(f*32)+((ishuju[9]-1)*96),0);
fread(herobody,1,32,picopen);
fseek(picopen,9152+((ishuju[3]-1)*768)+(f*32)+((ishuju[9]-1)*96),0);
fread(herocover,1,32,picopen);
}
WriteBlock(ishuju[6]*16,ishuju[7]*16,16,16,4,herocover);
WriteBlock(ishuju[6]*16,ishuju[7]*16,16,16,3,herobody);
Refresh();
f=f+1;
Delay(dtime);
}
}
if(ishuju[9]==4)//当人物向右时
{
for(k=0;k>-17;k=k-4)
{
ClearScreen();
WriteBlock(k,0,160,80,1,allscr);
WriteBlock(k+160,0,16,80,1,bufscr);
if(f==3 || f==4)
{
fseek(picopen,8384+((ishuju[3]-1)*384+288),0);
fread(herobody,1,32,picopen);
fseek(picopen,9152+((ishuju[3]-1)*768+288),0);
fread(herocover,1,32,picopen);
}
else
{
fseek(picopen,8384+((ishuju[3]-1)*384)+(f*32)+((ishuju[9]-1)*96),0);
fread(herobody,1,32,picopen);
fseek(picopen,9152+((ishuju[3]-1)*768)+(f*32)+((ishuju[9]-1)*96),0);
fread(herocover,1,32,picopen);
}
WriteBlock(ishuju[6]*16,ishuju[7]*16,16,16,4,herocover);
WriteBlock(ishuju[6]*16,ishuju[7]*16,16,16,3,herobody);
Refresh();
f=f+1;
Delay(dtime);
}
}
}
附:数据说明
ishuju[9]:人物面部方向(1为向上,2为向下,3为向左,4为向右)
a,b,t,k,f:这几个变量全部是临时的,是绘制地图用的
dtime:地图移动每帧图像的间隔时间(地图按每次+4的速度移动,用for语句实现循环,使地图滚屏,for语句每循环一次,Delay的时间就是dtime)
另外,还有个问题,我每次地图移动的时候,一直按键,则会一直移动,可是,这个程序好像是在地图移动这个子程序里的绘制地图部分要花费一点点时间,也许只是0.1秒的时间,可是,总感觉,每次地图滚屏移动一个图素的单位,虽然按键不松开会继续移动,但是,好像每次移动都会卡一下,大家运行就知道了,我用的的确是FantasyDR大哥教我的方法,可是怎么会出现这些问题呢?
求大侠们一定帮我一一解答!不胜感激!这对我的游戏进度有很大影响!谢谢大家了!!
如果您想与我直接联系,请加我的QQ:360634828
谢谢大家的帮忙了!
|
|