Actor > Kostüm#

Ein Costume ist eine Unterklasse von Appearance. Die meisten Methoden und Attribute werden von der Basisklasse Appearance geerbt.

API-Referenz#

class miniworlds.appearances.costume.Costume(*args, **kwargs)[Quellcode]#

Appearance for an actor.

A costume contains one or more images and defines how an actor looks. You can switch images in a costume to animate the actor.

Parameter:
  • actor – Optional actor to attach the costume to.

  • source – Optional image path, surface, color tuple, or list of image sources.

Examples

actor.add_costume("images/player.png")

costume = Costume()
costume.add_image("images/walk1.png")
actor.add_costume(costume)

costume = Costume(actor, "images/player.png")
after_init()[Quellcode]#

Wendet nach der Konstruktion die Standardwerte von Actor und Welt an.

animation_length#
bind_to_actor(actor)[Quellcode]#
Rückgabetyp:

None

classmethod create_managed(actor)[Quellcode]#
draw_images#
draw_shapes#
font_manager#
get_manager()[Quellcode]#

Gibt den zugehörigen Kostüm-Manager des Actors zurück.

get_rect()[Quellcode]#

Gibt ein frame-gecachtes lokales Rechteck für das gerenderte Kostümbild zurück.

id#
image_manager: image_manager.ImageManager#
property info_overlay#

Whether to draw a debug overlay around the actor.

Examples

actor.costume.info_overlay = True
Type:

bool

initialized#
last_image#
loop#
origin_changed()[Quellcode]#

Markiert Rendering nach einer Ursprungsänderung als dirty.

parent#

Das übergeordnete Element eines Kostüms ist der zugehörige Actor.

resized()[Quellcode]#

Markiert skalierungsabhängiges Rendering als dirty.

rotated()[Quellcode]#

Markiert rotationsabhängiges Rendering nach einer Actor-Rotation als dirty.

set_dirty(value='all', status=1)[Quellcode]#

Setzt Dirty-Flags und hält Actor-Rect-/Masken-Caches synchron.

set_image(source)[Quellcode]#

Select the active costume image.

Rückgabetyp:

bool

Parameter:

source – Image index, appearance, or color tuple.

Rückgabe:

True if the image exists.

Examples

costume.set_image(0)
surface_loaded#
transformations_manager#
visibility_changed()[Quellcode]#

Markiert nach Sichtbarkeitsänderungen das vollständige Rendering als dirty.

property world: World#

Zugehörige Welt dieses Kostüms.