FangEngine.game_object.premade.rotatable_sprite_sheet

This module contains a rotatable sprite sheet

Class RotatableSpriteSheet

This class represents a sprite sheet with basic 3D rotational functionality
This can only be used in a RotatableScreenBase screen or a derivative

__init__(self, screen_parent, x: float, y: float, angle: float, distance: float, image: str, tiles_wide: int, tiles_high: int, frames: int, speed: float = 0.1, scale_w: float = 1, scale_h: float = 1, color_key: typing.Tuple[int, int, int] = (255, 0, 255), args, kwargs)

Parameter screen_parent:
Parameter x: [unused]
Parameter y:
Parameter angle: The angle (in radians) to position the object at
Parameter distance: The distance the object should be from the player
Parameter image: the name of the image to retrieve from the image store
Parameter tiles_wide: the number of tiles wide in the animation
Parameter tiles_high: the number of tiles high in the animation
Parameter frames: the total number of frames in the animation
For example, in a 3x3 animation, if there are only 7 frames, then set this number to 7
Parameter speed: the number of seconds to remain on each frame
Parameter scale_w: the factor to scale the image horizontally
Parameter scale_h: the factor to scale the image vertically.
While the default is 1, if None is provided, this will be set to scale_w
Parameter color_key: an RGB color to be used as the invisible color (any color not included in any of the frames)
Parameter args:
Parameter kwargs:

broadcast_message(self, message: typing.Union[list, tuple, str])

Broadcasts a message to all other objects on this screen
Parameter message: the message to send

check_collision(self)

Causes this object to check for collisions with other objects
If a collision is detected, the on_collide event of both objects will be triggered

class_name(self) -> str

Returns the name of the class

convert_coords(self, x: float, y: float) -> typing.Tuple[float, float]

Scales coordinates with respect to the the scaling of the screen
This is especially useful for interacting with the mouse directly

get_draw_x(self) -> float

Calculate the x position to draw the object at

handle_input(self, keys: list, mouse: tuple, delta_t: float)

on_click(self, pos: tuple, button: int)

on_collide(self, other: GameObject)

on_create(self, args, kwargs)

This event is triggered when this object is created
It is run once and only once

on_joystick_axis_motion(self, joystick, axis, value)

on_joystick_ball_motion(self, joystick, ball, rel)

on_joystick_button_down(self, joystick, button)

on_joystick_button_up(self, joystick, button)

on_joystick_hat_motion(self, joystick, hat, value)

on_key_down(self, unicode, key, mod)

on_key_up(self, key, mod)

on_message_receive(self, message: typing.Union[list, tuple, str], sender)

This event is run when another object on the same screen broadcasts a message
Parameter message:
Parameter sender: the sender of the message

on_mouse_button_down(self, pos, button)

on_mouse_button_up(self, pos, button)

on_mouse_motion(self, pos, rel, buttons)

on_move(self, dx: float, dy: float)

on_screen_enter(self, previous_screen: str)

on_screen_leave(self, next_screen: str)

render(self, buffer: Surface)

Draws the rotatable object to the specified buffer

set_distance(self, distance: float)

Change the distance this object is away from the player

show_dialog_box(self, box: dialog_box.DialogBox.__class__, args, kwargs)

This method causes the screen to show a dialog box
Parameter box: the class reference to the dialog box
Parameter args:
Parameter kwargs:

update(self, delta_t: float)