J2me编程里处理人物的跳跃和碰撞的代码如何实现

来源:百度知道 编辑:UC知道 时间:2024/06/13 19:57:20
ACT游戏里用地图编辑器编辑后出现1~N号的小地图;我的意思是:人物和地图碰撞后(例如地图编号为42蘑菇),地图(42蘑菇)消失。还有就是人物跳起来要是再按一下左会向前移动一小步(或者按右会向后移动一小步)。O(∩_∩)O~不是这么简单哦

如何用2.0的话就用sprite函数的collideswith方法。如果是1.0就用这个方法
public static final boolean isIntersectingRect(int ax, int ay, int aw,

int ah, int bx, int by, int bw, int bh) {
if (by + bh < ay || // is the bottom of b above the top of a?
by > ay + ah || // is the top of b below bottom of a?
bx + bw < ax || // is the right of b to the left of a?
bx > ax + aw) // is the left of b to the right of a?
return false;

return true;
}
我说的是碰撞方法。哦
那你就把人物的坐标在第几行第几列算出来就可以啦