Entity
class in OpalScript
A live scene object. Missing, disabled, or destroyed references read as null.
Properties
| Member | Description |
|---|---|
| Group | Read-only authored object group. |
| Id | Read-only scene id. |
| Name | Read-only object name. |
| Position | Local position in pixels. Writes keep Motion targets in sync, like Transform.Position. |
| Rotation | Local rotation in degrees. Writes keep Motion targets in sync, like Transform.Rotation. |
| WorldPosition | Read-only sprite origin in scene world coordinates. |
| WorldPoint | Read-only typed sprite origin in world coordinates. |
Methods
| Member | Description |
|---|---|
| GetComponent | Find an enabled native or OpalScript component on this entity. Use other.GetComponent<T>() for an Entity reference. Returns null when missing or disabled. References are runtime-only and expose public members. |
| HasComponent | Whether this entity has an enabled component T. Null or expired entities return false. |
Example
csharp
void OnCollisionStart(Entity other) {
Health target = other.GetComponent<Health>();
if (target != null) {
target.TakeDamage(10);
}
}