Repository navigation
ExampleActor
da772 edited this page Feb 27, 2020
·
2 revisions
Actors are created and handled by the current scene. Creating an actor is done by calling new Actor() inside the context of an active scene. Actors are destroyed by calling Actor.Remove().
@Override
public void OnBegin() {
Actor myActor = new Actor("myActor") // Creates new actor called my actor on this scene
{
@Override
public void OnBegin() {
// Called when created
}
@Override
public void OnUpdate() {
// Called every frame
}
@Override
public void OnEnd() {
// Called when destroyed
}
};
}@Override
public void OnBegin() {
Actor myActor = new Actor("myActor"); // Creates new actor called my actor on this scene
Actor.Remove("myActor", this);
}Actors can also have components which add additional functionality to the actors. For example, actors can have a mesh component which displays an object on the screen.
@Override
public void OnBegin() {
Actor myActor = new Actor("myActor"); // Creates new actor called my actor on this scene
myActor.AddComponent(new Component("myComponent"));
myActor.RemoveComponent("myComponent");
}