WAP之家:为您提供最全最新的WAP技术,CP.SP.3G等行业资讯。 WAP之家交流论坛全新开放 点击进入>>
WAP资讯 | 3G动态 | SP动态 | 运营商动态 | 内容商动态 | 制造商动态 | 论坛讨论>> 每次自动访问
WAP技术 | WAP源码 | 手机编程 | 手机源码 | 无线技术 | J2ME技术 | 手机软件 添加到收藏夹
IVR技术 | SP资料 | SMS MMS技术 | 商业方案 | IVR下载 | 书籍教程 | 工具软件 语言:繁體中文

WAP之家技术文章J2ME技术进阶教程个人对45度地图结构的思考(含代码演示)

个人对45度地图结构的思考(含代码演示)
作者:不详  来源:J2ME.com.cn  发布时间:2005-11-24 17:13:56
currentDir = 3;
}
tally++;
break;
}
KEY_LAST = KEY_CURRENT;
if(IS_UP)
{
KEY_LAST = 0;
KEY_CURRENT = 0;
}
}

private void drawMap()
{
gb.setColor(0x00ffffff);
gb.fillRect(0, 0, nWidth, nHeight);
for(int i = 0; i < mapHeight; i++)
{
for(int j = 0; j < mapWidth; j++)
{
for(int k = 0; k <= mapDepth[j]; k++)
{
gb.drawImage(mapImg,
nWidth / 2 + j * cellSizeWidth / 2 - i * cellSizeWidth / 2 - (targetMX * cellSizeWidth / 2 - targetMY * cellSizeWidth / 2),
-k * 16 + nHeight / 2 + j * cellSizeHeight / 2 + i * cellSizeHeight / 2 - (targetMX * cellSizeHeight / 2 + targetMY * cellSizeHeight / 2),
3);
}
}
}
}
//人物固定在屏幕中间(nwidht/2,nHeight / 2的地方
private void drawPerson()
{
//人物绘制部分,只考虑高度问题。在屏幕上的坐标固定为nWidth/2,nHeight/2.
gb.drawImage(menImg[currentDir][(tally / 2)%2], nWidth / 2,
nHeight / 2 - mapDepth[targetMY][targetMX] * 16, 33);
/////
for(int j = targetMX + 1; j < mapWidth; j++)
{
for(int k = 1; k <= mapDepth[targetMY][j]; k++)
{

gb.drawImage(mapImg,
nWidth / 2 + j * cellSizeWidth / 2 - targetMY * cellSizeWidth / 2 - (targetMX * cellSizeWidth / 2 - targetMY * cellSizeWidth / 2),
-k * 16 + nHeight / 2 + j * cellSizeHeight / 2 + targetMY * cellSizeHeight / 2 - (targetMX * cellSizeHeight / 2 + targetMY * cellSizeHeight / 2),
3);
}
}
for(int i = targetMY + 1; i < mapHeight; i++)
{
for(int j = 0; j < mapWidth; j++)
{
if(j >= mapHeight)
{
continue;
}
for(int k = 1; k <= mapDepth[j]; k++)
{
gb.drawImage(mapImg,
nWidth / 2 + j * cellSizeWidth / 2 - i * cellSizeWidth / 2 - (targetMX * cellSizeWidth / 2 - targetMY * cellSizeWidth / 2),
-k * 16 + nHeight / 2 + j * cellSizeHeight / 2 + i * cellSizeHeight / 2 - (targetMX * cellSizeHeight / 2 + targetMY * cellSizeHeight / 2),
3);
}
}
}
}

private void drawBalk()
{

}

}

相关下载:点击下载

上一页  [1] [2] 

[] [返回上一页] [打 印]
文章评论

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码