Package com.csse3200.game.ui
Class NonDraggableCharacter
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.ui.NonDraggableCharacter
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
Fields inherited from class com.csse3200.game.rendering.RenderComponent
colour
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Initializes the character by adding the image actor to the stage.void
dispose()
Disposes of the character image.protected void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the character image at the specified offsets.float
Gets the current X offset of the character image.float
Gets the current Y offset of the character image.float
getScale()
Gets the current scale of the character image.Gets the current texture path of the character.void
setOffsets
(float x, float y) void
setScale
(float scale) void
setTexture
(String path) void
update()
A function that checks if the 'R' key is pressed while the mouse is over the character image.Methods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndex
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, getColour, render, setColour
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, getPriority, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
NonDraggableCharacter
public NonDraggableCharacter()
-
-
Method Details
-
create
public void create()Initializes the character by adding the image actor to the stage.- Overrides:
create
in classUIComponent
-
dispose
public void dispose()Disposes of the character image.- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the character image at the specified offsets.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- The SpriteBatch used for drawing.
-
getTexturePath
Gets the current texture path of the character.- Returns:
- The texture path as a String.
-
getOffsetX
public float getOffsetX()Gets the current X offset of the character image.- Returns:
- The X offset as a float.
-
getOffsetY
public float getOffsetY()Gets the current Y offset of the character image.- Returns:
- The Y offset as a float.
-
getScale
public float getScale()Gets the current scale of the character image.- Returns:
- The scale as a float.
-
update
public void update()A function that checks if the 'R' key is pressed while the mouse is over the character image. If so, it removes the image from the stage and disposes of the entity. -
setTexture
-
setOffsets
public void setOffsets(float x, float y) -
setScale
public void setScale(float scale)
-