Appearance -> Costume#
The ‘Costume’ class is a child classes of the ‘Appearance’ class.
Note
Usually costumes are created with token.add_costume([image_path|color])
Costume#
- class miniworldmaker.appearances.costume.Costume(*args, **kwargs)[source]#
A costume contains one or multiple images
Every token has a costume which defines the “look” of the token. You can switch the images in a costume to animate the token.
A costume is created if you add an image to an actor with token.add_image(path_to_image)
Public Data Attributes:
Implemented in subclasses Costume and Background
Shows info overlay (Rectangle around the token and Direction marker)
image_manager
Inherited from
Appearance
If True, the image is tiled over the background.
If True, costume will be rotated with token direction
If True, the image will be rotated by parent orientation before it is rotated.
Flips the costume or background.
Scales the actor to parent-size without remaining aspect-ratio.
If True, the image will be upscaled remaining aspect-ratio.
Defines a colored layer.
Defines a transparency.
transparent, 255: visible If value < 1, it will be multiplied with 255.
If True, the costume will be animated.
->See fill color
Is token filled with color?
see border color
border color of token
The border-size of token.
Sets text of appearance .
Performs all actions in image pipeline
Implemented in subclasses Costume and Background
image_manager
Public Methods:
__init__
(token)set_image
(source)- type source:
rotated
()resized
()visible
()set_dirty
([value, status])Inherited from
Appearance
__init__
()set_defaults
(rotatable, is_animated, ...)- rtype:
set_font
(font, font_size)set_animation_speed
(value)flip
(value)add_image
(source)Adds an image to the appearance
set_image
(source)Sets the displayed image of costume/background to selected index
add_images
(sources)Adds multiple images to background/costume.
animate
([loop])Animates the costume
the method is overwritten in subclasses costume and appearance
Create an array from costume or background.
from_array
(arr)Create a background or costume from array.
fill
(value)Set default fill color for borders and lines
get_color
(position)get_rect
()draw
(source, position, width, height)draw_on_image
(path, position, width, height)draw_color_on_image
(color, position, width, ...)__str__
()Return str(self).
set_text
(value)If dirty, the image will be reloaded.
update
()Loads the next image, called 1/frame
register
(method)Register method for decorator.
draw_shape_append
(shape, arguments)draw_shape_set
(shape, arguments)draw_image_append
(surface, rect)draw_image_set
(surface, rect)set_dirty
([value, status])Private Methods:
_set_default_color_values
()_set_token_default_values
()_set_board_default_values
()_inner_shape
()Returns inner shape of costume
_outer_shape
()Returns outer shape of costume
Inherited from
Appearance
_before_transformation_pipeline
()Called in get_image, if image is "dirty" (e.g.
_after_transformation_pipeline
()Called in get_image, if image is "dirty" (e.g.
_load_image
()Loads the image,
_update_draw_shape
()- rtype:
_inner_shape
()Returns inner shape of costume
_outer_shape
()Returns outer shape of costume
_inner_shape_arguments
()def setGets arguments for inner shape
_outer_shape_arguments
()Gets arguments for outer shape
- property info_overlay#
Shows info overlay (Rectangle around the token and Direction marker)
- parent#
the parent of a costume is the associated token.