FangEngine.screen_manager.rotatable_screen.rotatable_screen_base

This module contains the RotatableScreenBase

Class RotatableScreenBase

The RotatableScreenBase is designed for environments where objects revolve around the player
This is perfect for first person levels

__init__(self, name: str, manager)

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

Broadcasts a message to all objects in this screen
Parameter message:
Parameter sender: default is this object

center_mouse(self)

Moves the mouse cursor to the center of the screen

center_mouse_x(self)

Moves the mouse cursor so it is centered along the x axis

center_mouse_y(self)

Moves the mouse cursor so it is centered along the y axis

check_collisions(self, child: game_object.GameObject)

This method checks if the specified object is colliding with any other game object

clear_game_objects(self)

Removes all game objects from the screen

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

Converts the coordinates relative to the camera

get_cursor_pos(self) -> typing.Tuple[float, float]

Returns the mouse cursor's position
The position is automatically scaled so this is the safest way to get the position

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

hide_mouse(self)

Hides the mouse cursor

is_showing_dialog_box(self) -> bool

Returns if there are any dialog boxes currently being displayed

on_create(self)

This event is triggered when the screen 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: str, sender)

This event is triggered whenever a message is sent
Parameter message:
Parameter sender: the object which broadcast the message

on_mouse_button_down(self, pos, button)

on_mouse_button_up(self, pos, button)

on_mouse_motion(self, pos, rel, buttons)

on_screen_enter(self, previous_screen: str)

on_screen_leave(self, next_screen: str)

play_sound(self, sound: Sound, loops: int = 0, left: float = 1.0, right: float = 1.0)

Plays a sound
Parameter sound: the Pygame Sound object to play
Parameter loops:
Parameter left: the left volume to play the sound (0-1)
Parameter right: the right volume to play the sound (0-1)

For example, if left is 0 and right is 1, then the sound will only be played out of the right speaker/earphone

render(self, buffer: Surface)

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

Shows a new dialog box
Parameter box: the reference to the dialog box class to show
Parameter args:
Parameter kwargs:

show_mouse(self)

Shows the mouse cursor

spawn_object(self, object_class_ref: game_object.GameObject.__class__, x: float, y: float, args, kwargs) -> game_object.GameObject

Spawns a new game object
Parameter object_class_ref: the reference to the class. The class MUST extend the GameObject class
Parameter x:
Parameter y:
Parameter args:
Parameter kwargs:

spawn_rotatable_image(self, image: str, angle: float, distance: float, y: float = 0, scale_x: float = 1, scale_y: float = None, args, kwargs)

This method spawns a rotatable image
It simplifies the object spawning process
Parameter image: the name of the image to spawn in the image cache
Parameter angle: the angle relative to the world
Parameter distance: the distance away from the player
Parameter y: the y position relative to the screen
Parameter scale_x:
Parameter scale_y:
Parameter args:
Parameter kwargs:
Returns

spawn_rotatable_object(self, object_class_ref: rotatable_object.RotatableObject.__class__, angle: float, distance: float, y: float = 0, scale_x: float = 1, scale_y: float = None, args, kwargs)

This method spawns a rotatable object
It simplifies the object spawning process
Parameter object_class_ref: the reference to the object class
Parameter angle: the angle relative to the world
Parameter distance: the distance away from the player
Parameter y: the y position relative to the screen
Parameter scale_x:
Parameter scale_y:
Parameter args:
Parameter kwargs:
Returns

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

This method spawns a rotatable spritesheet
It simplifies the object spawning process
Parameter image: the name of the image to spawn in the image cache
Parameter angle: the angle relative to the world
Parameter distance: the distance away from the player
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 y: the y position relative to the screen
Parameter args:
Parameter kwargs:
Returns

update(self, delta_t: float)