Class Actor
Actors are the objects in a scene. Also referred to as GameObject or Entity. Positioning center-point.
The Actor holds a name, the scene its in (witch is declared when added to a scene), a transform,
a sprite object, a collision body (visibility bounds by default) and a configuration object.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Configuration
Configuration settings for the actorprotected final String
Identifier of the Actorprotected Scene
Scene the actor is in.protected final Sprite
Sprite of the Actorprotected final Transform
Transform of the Actor (Relative to world) -
Constructor Summary
ConstructorDescriptionActor
(String name, Transform transform, Sprite sprite, ActorComponent... components) Creates a new instance of an Actor object setting the default configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(ActorComponent component) Add a tvoid
void
destroy()
Gets the collision bounds as a Rectangle object.getName()
getScene()
Gets the visibility bounds as a Rectangle object.void
Instance an Actor in multiple locationsboolean
isActive()
boolean
void
registerCollideEvent
(CollideEvent collideEvent) void
setActive
(boolean active) void
toString()
-
Field Details
-
name
Identifier of the Actor -
scene
Scene the actor is in. Assessed when added to a scene.- See Also:
-
transform
Transform of the Actor (Relative to world) -
sprite
Sprite of the Actor -
configuration
Configuration settings for the actor
-
-
Constructor Details
-
Actor
Creates a new instance of an Actor object setting the default configuration.- Parameters:
name
- Name of the actor, doesn't have to be uniquetransform
- The transform containing the actor's position, size and rotationsprite
- Sprite object containing the actor's rendering datacomponents
- Components to be added to this actor
-
-
Method Details
-
instance
Instance an Actor in multiple locations -
getVisibilityBounds
Gets the visibility bounds as a Rectangle object. Transforming to top-left positioning. Used for collisions.- Returns:
- The visibility bounds in TL space.
- See Also:
-
getCollisionBounds
Gets the collision bounds as a Rectangle object. Transforming to top-left positioning. If no collision body is defined, it returns the visibility bounds. Used for collisions.- Returns:
- The collision bounds in TL space.
- See Also:
-
getAnchorPoint
-
add
Description copied from class:Holder
Add a t- Overrides:
add
in classHolder<ActorComponent>
-
registerCollideEvent
-
getCollideEvents
-
clearCollideEvents
public void clearCollideEvents() -
getCollisions
-
getName
-
isActive
public boolean isActive() -
setActive
public void setActive(boolean active) -
isDestroyed
public boolean isDestroyed() -
destroy
public void destroy() -
getTransform
-
getSprite
-
getScene
-
setScene
-
getInstances
-
getConfiguration
-
toString
-