Package io.github.team6ENG.EscapeUni
Class Player
java.lang.Object
io.github.team6ENG.EscapeUni.SpriteAnimations
io.github.team6ENG.EscapeUni.Player
Represents and controls the main player character
-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.badlogic.gdx.graphics.g2d.TextureRegionbooleanbooleanbooleanbooleanbooleanbooleanprotected intprotected intfloatcom.badlogic.gdx.graphics.g2d.Spritecom.badlogic.gdx.scenes.scene2d.ui.ImageFields inherited from class io.github.team6ENG.EscapeUni.SpriteAnimations
animations, mapWallsId, tileDimensions, wallsLayer, x, y -
Constructor Summary
ConstructorsConstructorDescriptionPlayer(Main g, AudioManager audioManager, int mapLangwithBarriersId, int waterId) Initialises the player and its animations -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()voidhandleInput(float delta, float speedModifier) Check for keyboard input and move playervoidupdatePlayer(float stateTime) Update player animation and torch positionMethods inherited from class io.github.team6ENG.EscapeUni.SpriteAnimations
generateAnimation, loadSprite
-
Field Details
-
currentPlayerFrame
public com.badlogic.gdx.graphics.g2d.TextureRegion currentPlayerFrame -
speed
public float speed -
mapLangwithBarriersId
protected int mapLangwithBarriersId -
mapWaterId
protected int mapWaterId -
sprite
public com.badlogic.gdx.graphics.g2d.Sprite sprite -
torch
public com.badlogic.gdx.scenes.scene2d.ui.Image torch -
isFacingUp
public boolean isFacingUp -
isFacingLeft
public boolean isFacingLeft -
isMoving
public boolean isMoving -
isMovingHorizontally
public boolean isMovingHorizontally -
inWater
public boolean inWater -
hasEnteredLangwith
public boolean hasEnteredLangwith
-
-
Constructor Details
-
Player
Initialises the player and its animations- Parameters:
g- current instance of Main
-
-
Method Details
-
handleInput
public void handleInput(float delta, float speedModifier) Check for keyboard input and move player- Parameters:
delta- time in seconds since last frame
-
updatePlayer
public void updatePlayer(float stateTime) Update player animation and torch position- Parameters:
stateTime- time in seconds since last frame
-
dispose
public void dispose()- Overrides:
disposein classSpriteAnimations
-