Game Development Reference
In-Depth Information
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.packtpub.libgdx.canyonbunny.game.Assets;
import com.packtpub.libgdx.canyonbunny.util.Constants;
public class BunnyHead extends AbstractGameObject {
public static final String TAG = BunnyHead.class.getName();
private final float JUMP_TIME_MAX = 0.3f;
private final float JUMP_TIME_MIN = 0.1f;
private final float JUMP_TIME_OFFSET_FLYING =
JUMP_TIME_MAX - 0.018f;
public enum VIEW_DIRECTION { LEFT, RIGHT }
public enum JUMP_STATE {
GROUNDED, FALLING, JUMP_RISING, JUMP_FALLING
}
private TextureRegion regHead;
public VIEW_DIRECTION viewDirection;
public float timeJumping;
public JUMP_STATE jumpState;
public boolean hasFeatherPowerup;
public float timeLeftFeatherPowerup;
public BunnyHead () {
init();
}
public void init () {};
public void setJumping (boolean jumpKeyPressed) {};
public void setFeatherPowerup (boolean pickedUp) {};
public boolean hasFeatherPowerup () {};
}
Now that we have defined the viewing direction—a state for jumping and another
state for the feather power-up—we can go on and fill in the specific implementation
details of the still empty methods.
 
Search WWH ::




Custom Search