vAna
package com.tilegame.sprites;
import com.graphics.Animation;
/**
The Player.
- /
public class Player extends Creature { private static final float JUMP_SPEED = -.95f; public boolean onGround; public Player(Animation left, Animation right, Animation deadLeft, Animation deadRight, Animation runLeft, Animation runRight, Animation jumpLeft, Animation jumpRight, Animation punchLeft, Animation punchRight) { super(left, right, deadLeft, deadRight, runLeft, runRight, jumpLeft, jumpRight, punchLeft, punchRight); } public void collideHorizontal() { setVelocityX(0); } public void collideVertical() { // check if collided with ground if (getVelocityY() > 0) { onGround = true;
this.setState(STATE_NORMAL);
} setVelocityY(0); } public void setY(float y) { // check if falling if (Math.round(y) > Math.round(getY())) { onGround = false; } super.setY(y); } public void wakeUp() { // do nothing } /** Makes the player jump if the player is on the ground or if forceJump is true. */ public void jump(boolean forceJump) { if (onGround || forceJump) { onGround = false; setVelocityY(JUMP_SPEED); //this.anim = this.jumpRight; } }
public void hasAttacked(){
} public float getMaxSpeed() { return 0.5f; } }