Skip to content

RenderComponent

RenderComponent

color property writable

color: Vector4

Tint/fill color (RGBA, 0-1) applied to the shape and any texture

enable property writable

enable: bool

Whether this component is active. Disabling hides the object's rendered shape.

owner property

owner: Object

The Object that owns this component

shape property writable

shape: PolygonShape | RectangleShape | CircleShape

The shape used to render this object. Accepts a RectangleShape, CircleShape, or PolygonShape. Equivalent to calling set_shape().

z_index property writable

z_index: int

Draw order relative to other render components. Higher values draw on top.

add_child

add_child(obj: Object) -> Object

Add obj as a child of this component's owning Object

add_component

add_component(component_class: Any) -> typing.Any

Attach a new component of the given type to this component's owning Object.

Example
render = self.add_component(RenderComponent)

add_object

add_object(obj: Object, parent: Object = None) -> Object

Add a newly created Object to the scene, optionally parented to another Object

get_component

get_component(component_class: Any) -> typing.Any

Look up a component on this Object

get_owner

get_owner() -> Object

The Object that owns this component

has_component

has_component(component_class: Any) -> bool

Check whether this component's owning Object has a component of the given type

remove_component

remove_component(component_class: Any) -> None

Remove a component of the given type from this component's owning Object

remove_object

remove_object(obj: Object) -> None

Remove an object from the scene

set_enable

set_enable(arg0: bool) -> None

Set enable. See the enable property.

set_shape

set_shape(shape: PolygonShape | RectangleShape | CircleShape) -> None

Accepts a RectangleShape, CircleShape, or PolygonShape

set_texture

set_texture(virtual_path: str) -> None

Load a texture from a res:// path (e.g. 'res://textures/wood.png'), or pass '' to clear it