MIDP 2.0 开发J2ME游戏起步之二
日期:2007年5月4日 作者: 查看:[大字体 中字体 小字体]-
myJumpedOver = false;
setVisible(true);
// Set the tumbleweed's position to the point
// where it just barely appears on the screen
// so that it can start approaching the cowboy:
if(myLeft) {
setRefPixelPosition(currentRightBound, myY);
move(-1, 0);
} else {
setRefPixelPosition(currentLeftBound, myY);
move(1, 0);
}
}
} else {
// When the tumbleweed is active, you advance the
// rolling animation to the next frame and then
// move the tumbleweed in the right direction across
// the screen.
if(tickCount % 2 == 0) { // Slow the animation down a little. nextFrame();
}
if(myLeft) {
move(-3, 0);
// If the cowboy just passed the tumbleweed
// (without colliding with it), you increase the
// cowboy's score and set myJumpedOver to true
// so that no further points will be awarded
// for this tumbleweed until it goes off the screen
// and then is later reactivated:
if((! myJumpedOver) && (getRefPixelX() < cowboy.getRefPixelX())) {
myJumpedOver = true;
retVal = cowboy.increaseScoreThisJump();
}
} else {
move(3, 0);
if((! myJumpedOver) && (getRefPixelX() > cowboy.getRefPixelX() + Cowboy.WIDTH)) {
myJumpedOver = true;
retVal = cowboy.increaseScoreThisJump();
}
}
}
return(retVal);
}/**
* Gets a random int between
* zero and the param upper.
*/
public int getRandomInt(int upper) {
int retVal = myRandom.nextInt() % upper;
if(retVal < 0) {
retVal += upper;
}
return(retVal);
}}
TiledLayer类象前面提到的,TiledLayer与Sprite类很相似,只是TiledLayer类包含多列,每一列被一套独立的图象帧绘制。另一个区别是TiledLayer类中缺乏大多数功能性相关的方法;TiledLayer没有转换,参考象素,甚至帧顺序。
- 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] 下一页
-
- MIDP 2.0 开发J2ME游戏起步之二 相关文章:
- ·Web2.0在中国步入歧途 缺赢利模式VC有错
- ·C #中的几个线程同步对象方法
- ·简单七步最大限度优化你的博客文章
- ·江民教你五步远离“机器狗”病毒侵扰
- ·加强边界路由器安全防护的几个步骤
- ·教你两步彻底根除系统多余输入法
- ·改进SQL Server数据库系统安全五步走
- ·Photoshop调色 五步搞定军色效果
- ·ASP.NET AJAX中的异步Web Services调用
- ·Office文档打印成为TIFF图形文件的步骤
- MIDP 2.0 开发J2ME游戏起步之二 相关软件
- ·忧郁狐步
- ·《月球漫步》模拟器
- ·《独步武林》
- ·独步天下
- ·NDS《简单DS系列Vol.21 步兵》模拟器
- ·《交易》— 步入权利与欲望的死亡陷阱
- ·《文学散步》
- ·全年龄段言情主义大作《步步惊心》实体书版(全本)
- ·《步非烟作品全集》
- ·与孙子兵法同步思考
- 特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作
- 者.文章版权归文章原始作者所有.对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转
- 载的文章有版权问题请联系编辑人员,我们尽快予以更正. 转载请注明来源:http://www.hackhome.com
精品推荐
热点TOP10
- ·图象处理中的边缘检测------canny算子
- ·EZ-USB 68013A开发指南
- ·数值计算程序大放送-特征值和特征向量
- ·ARM的嵌入式Linux移植体验之BootLoader
- ·Visual C++ ADO数据库编程入门
- ·智能手机Smartphone开发导语
- ·利用 wordXP 实现自动排班
- ·[分形]DLA团簇模型的摸拟
- ·DENX U-Boot及Linux使用手册
- ·Static和Final修饰类属性变量及初始化
- ·BPEL的异常管理
- ·看Vue 5 Esprit函数的节点与链接详情
- ·初学者全面接触学习jquery(译文)
- ·LinQ学习之旅 从整型数组中找出偶数
- ·Enterprise Library 快速入门
- ·CVS源代码库服务器建立和权限配置
- ·Visual FoxPro 9.0 SP2正式版下载
- ·VS2005控件的问题解决办法
- ·Cookie是什么?用法是怎样?与SESSION有什么区别?
- ·J2SE API读取Properties文件的六种方法
