Super Jumper: A 2D OpenGL ES Game Development Guide
1. Platform Class
The Platform class has two important methods: update() and pulverize() .
update() method :
public void update(float deltaTime) {
if(type == PLATFORM_TYPE_MOVING) {
position.add(velocity.x * deltaTime, 0);
bounds.lowerLeft.set(position).sub(PLATFORM_WIDTH / 2, PLATFORM_HEIGHT / 2);
if(position.x < PLATFORM_WIDTH / 2) {
velocity.x = -velocity.x;
position.x = PLATFORM_WIDTH / 2;
}
if(position.x > World.WORLD_WIDTH - PLATFORM_WIDTH / 2) {
velocity.x = -velocity.x;
position.x
超级会员免费看
订阅专栏 解锁全文
62

被折叠的 条评论
为什么被折叠?



