MIDP 2.0 开发J2ME游戏起步之二
日期:2007年5月4日 作者: 查看:[大字体 中字体 小字体]-
myInitialY = initialY;
// You define the reference pixel to be in the middle
// of the cowboy image so that when the cowboy turns
// from right to left (and vice versa) he does not
// appear to move to a different location.
defineReferencePixel(WIDTH/2, 0);
setRefPixelPosition(myInitialX, myInitialY);
setFrameSequence(FRAME_SEQUENCE);
}//---------------------------------------------------------
// Game methods/**
* If the cowboy has landed on a tumbleweed, you decrease
* the score.
*/
int checkCollision(Tumbleweed tumbleweed) {
int retVal = 0;
if(collidesWith(tumbleweed, true)) {
retVal = 1;
// Once the cowboy has collided with the tumbleweed,
// that tumbleweed is done for now, so you call reset,
// which makes it invisible and ready to be reused.
tumbleweed.reset();
}
return(retVal);
}/**
* Set the cowboy back to its initial position.
*/
void reset() {
myIsJumping = myNoJumpInt;
setRefPixelPosition(myInitialX, myInitialY);
setFrameSequence(FRAME_SEQUENCE);
myScoreThisJump = 0;
// At first the cowboy faces right:
setTransform(TRANS_NONE);
}//---------------------------------------------------------
// Graphics/**
* Alter the cowboy image appropriately for this frame.
*/
void advance(int tickCount, boolean left) {
if(left) {
// Use the mirror image of the cowboy graphic when
// the cowboy is going toward the left.
setTransform(TRANS_MIRROR);
move(-1, 0);
} else {
// Use the (normal, untransformed) image of the cowboy
// graphic when the cowboy is going toward the right.
setTransform(TRANS_NONE);
move(1, 0);
}
// This section advances the animation: - 上一页 [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文件的六种方法
