Package sk.tuke.kpi.gamelib
Interface Actor
-
public interface Actor
Actor represents any figure in a game. It has position, dimensions,name
andanimation
(graphical representation). It belongs to a singlescene
, where it can have scheduledactions to perform
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addedToScene(@NotNull Scene scene)
Called when the actor is added toscene
.@NotNull Animation
getAnimation()
int
getHeight()
@NotNull java.lang.String
getName()
@NotNull Point
getPosition()
int
getPosX()
int
getPosY()
@Nullable Scene
getScene()
int
getWidth()
boolean
intersects(@NotNull Actor actor)
void
removedFromScene(@NotNull Scene scene)
Called when the actor is removed fromscene
.void
setPosition(int posX, int posY)
Sets actor position by specifyingposX
andposY
coordinates.
-
-
-
Method Detail
-
getPosX
int getPosX()
- Returns:
- X position of the bottom left corner of actor's animation
-
getPosY
int getPosY()
- Returns:
- Y position of the bottom left corner of actor's animation
-
getWidth
int getWidth()
- Returns:
- actor's width
-
getHeight
int getHeight()
- Returns:
- actor's height
-
getName
@NotNull @NotNull java.lang.String getName()
- Returns:
- actor's name
-
getScene
@Nullable @Nullable Scene getScene()
- Returns:
- scene containing the actor
-
setPosition
void setPosition(int posX, int posY)
Sets actor position by specifyingposX
andposY
coordinates.
-
addedToScene
void addedToScene(@NotNull @NotNull Scene scene)
Called when the actor is added toscene
.
-
removedFromScene
void removedFromScene(@NotNull @NotNull Scene scene)
Called when the actor is removed fromscene
.
-
intersects
boolean intersects(@NotNull @NotNull Actor actor)
- Returns:
- true if the actor intersects with the given actor.
-
-