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

42 lines
977 B
Java

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