MIDP 2.0 开发J2ME游戏起步之二
日期:2007年5月4日 作者: 查看:[大字体 中字体 小字体]-
* The Y coordinate of the tumbleweed.
*/
private int myY;//---------------------------------------------------------
// Initialization/**
* Constructor initializes the image and animation.
* @param left Whether this tumbleweed enters from the left.
*/public Tumbleweed(boolean left) throws Exception {
super(Image.createImage("/images/tumbleweed.png"), WIDTH, WIDTH);
myY = JumpManager.DISP_HEIGHT - WIDTH - 2;
myLeft = left;
if(!myLeft) {
setTransform(TRANS_MIRROR);
}
myJumpedOver = false;
setVisible(false);
}//---------------------------------------------------------
// Graphics/**
* Move the tumbleweed back to its initial (inactive) state.
*/
void reset() {
setVisible(false);
myJumpedOver = false;
}/**
* Alter the tumbleweed image appropriately for this frame.
* @param left Whether the player is moving left
* @return How much the score should change by after this
* advance.
*/
int advance(Cowboy cowboy, int tickCount, boolean left, int currentLeftBound, int currentRightBound) {
int retVal = 0;
// If the tumbleweed goes outside of the display
// region, set it to invisible since it is
// no longer in use.
if((getRefPixelX() + WIDTH <= currentLeftBound) (getRefPixelX() - WIDTH >= currentRightBound)) {
setVisible(false);
}
// If the tumbleweed is no longer in use (i.e., invisible)
// it is given a 1 in 100 chance (per game loop)
// of coming back into play:
if(!isVisible()) {
int rand = getRandomInt(100);
if(rand == 3) {
// When the tumbleweed comes back into play,
// you reset the values to what they should
// be in the active state: - 上一页 [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文件的六种方法
