Actor

class Actor(parent: ActorParent) : ActorParent

An Actor represents every item you see within the game, and is arguably the most important Kyd class,

Even static scenery are Actors.

You may argue that Actor is a bad name for scenery, but it makes me smile as it reminds me of a scene in "A Midsummer Night's Dream". There is a play within a play, and one of the actors takes on the role of a wall. In the original :

_Bottom_ : let him hold his fingers thus, and through that cranny shall _Pyramus_ and _Thisbe_ whisper.

However, in the version I saw, Wall was played by a petite young actress in a leotard, and an entirely different cranny was chosen. While kneeling down Pyramus couldn't be heard by Thisbe, so Wall suggests Pyramus widen the cranny with his fingers. The look on Pyramus' face was priceless. Shakespeare plays are often smutty, but they took it to another level. If you are ever in London, take in a comedy at The Globe - cheap a chips and funny as hell.

Constructors

Link copied to clipboard
constructor(parent: ActorParent)

Properties

Link copied to clipboard
Link copied to clipboard
val angleDegreesProperty: FloatProperty

The angle of rotation about position point (measured in degrees). Positive angles are anticlockwise, i.e. PI/2 radians will rotate a quart-turn anticlockwise.

Link copied to clipboard

The angle of rotation about position point (measured in radians). Positive angles are anticlockwise, i.e. PI/2 radians will rotate a quart-turn anticlockwise.

Link copied to clipboard
Link copied to clipboard
val appearanceProperty: SimpleProperty<Appearance>
Link copied to clipboard
Link copied to clipboard
val behaviourProperty: SimpleProperty<Behaviour>
Link copied to clipboard
Link copied to clipboard
val behaviourTypeProperty: StringProperty

TODO This won't be needed when the editor dynamically loads the game's jar files. Without this, behaviours will reset to NoRole when an act is saved.

Link copied to clipboard
open override val children: MutableObservableList<Actor>
Link copied to clipboard
var id: String
Link copied to clipboard
val idProperty: StringProperty

If you wish to find an actor by its id. There is no guarantee of uniqueness. Kyd itself doesn't use this field, it exists only because it might be useful. toString includes the id, which may help debugging.

Link copied to clipboard
Link copied to clipboard
val isBelowProperty: BooleanProperty

When this Actor is a child (rather than being part of a Stage), should it be drawn BELOW its parent?

Link copied to clipboard
val localToWorld: Matrix
Link copied to clipboard
val localToWorldProperty: ObservableValue<Matrix>

A transformation matrix used while drawing.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The position of the actor relative to its parent. For a top-level actor (whose parent is a Stage), this uses CoordinateSystem.world. But if this is a child of another Actor, the position is relative to the parent Actor (See CoordinateSystem.child).

Link copied to clipboard
var role: Role?
Link copied to clipboard
val roleProperty: SimpleProperty<Role?>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A convenient alternative to get/set scale.x

Link copied to clipboard

A convenient way to set the x and y values of scale. If you read the value, it returns the x component of scale.

Link copied to clipboard

A convenient alternative to get/set scale.y

Link copied to clipboard

Additional data used by the editor. Never used during game-play.

Link copied to clipboard
Link copied to clipboard
val visibleProperty: BooleanProperty

Hides the actor without changing its appearance.

Link copied to clipboard
val worldToLocal: Matrix
Link copied to clipboard
val worldToLocalProperty: ObservableValue<Matrix>
Link copied to clipboard
var x: Float

A convenient alternative to get/set position.x

Link copied to clipboard
var y: Float

A convenient alternative to get/set position.y

Link copied to clipboard
Link copied to clipboard
val zOrderProperty: FloatProperty

Only used when placed on a ZOrderStage. It is often better to create separate Stages, rather than using zOrder. For example, if you have terrain, walking and flying objects, create 3 stages. When you do this, the zOrder is often not relevant.

Functions

Link copied to clipboard
open override fun addActor(actor: Actor)
Link copied to clipboard
fun colorAtWorldPoint(worldPoint: Vector2): Color

Returns our color at a given worldPoint. If the point is outside our bounds, it will always be Color.TRANSPARENT. This is used to test if a mouse event is touching this actor, by comparing the color's alpha with a threshold value.

Link copied to clipboard
open override fun removeActor(actor: Actor)
Link copied to clipboard
open override fun toString(): String