ColorRunner/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java

42 lines
977 B
Java
Raw Normal View History

2014-08-10 17:19:40 +02:00
package de.samdev.colorrunner.game.world.entities.gameentities;
2014-08-10 19:41:06 +02:00
import com.badlogic.gdx.Gdx;
import de.samdev.colorrunner.game.world.CRGameWorld;
2014-08-10 17:19:40 +02:00
import de.samdev.colorrunner.game.world.entities.GravityEntity;
2014-08-10 19:41:06 +02:00
import de.samdev.colorrunner.input.SwipeDirection;
2014-08-10 17:19:40 +02:00
public class PlayerEntity extends GravityEntity {
public final static float PLAYER_WIDTH = 32;
public final static float PLAYER_HEIGHT = 32;
2014-08-10 19:41:06 +02:00
public final static float PLAYER_JUMP_FORCE = 456;
public final static float PLAYER_FLY_FORCE = 1.5f;
2014-08-10 17:19:40 +02:00
2014-08-10 19:41:06 +02:00
public PlayerEntity(CRGameWorld _owner, float x, float y) {
super(_owner, x, y, PLAYER_WIDTH, PLAYER_HEIGHT);
velocity.x = 320;
2014-08-10 17:19:40 +02:00
}
@Override
2014-08-10 19:41:06 +02:00
public void update(float delta) {
2014-08-10 17:19:40 +02:00
super.update(delta);
2014-08-10 19:41:06 +02:00
}
public void jump() {
if (isOnFloor)
velocity.y = PLAYER_JUMP_FORCE;
}
public void switchPhase(SwipeDirection sd) {
// TODO Auto-generated method stub
2014-08-10 17:19:40 +02:00
2014-08-10 19:41:06 +02:00
}
public void fly() {
if (! isOnFloor)
velocity.y += PLAYER_FLY_FORCE;
2014-08-10 17:19:40 +02:00
}
}