Snow Effect¶
Copyright 2023 Ethan Christensen
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class bruhanimate.bruheffect.snow_effect.SnowEffect(buffer: Buffer, background: str, img_start_x: int = None, img_start_y: int = None, img_width: int = None, img_height: int = None, collision: bool = False, show_info: bool = False)[source]¶
Bases:
BaseEffect
A class to represent a snow effect.
- __init__(buffer: Buffer, background: str, img_start_x: int = None, img_start_y: int = None, img_width: int = None, img_height: int = None, collision: bool = False, show_info: bool = False)[source]¶
Initializes the SnowEffect class.
- Parameters:
buffer (Buffer) – Effect buffer to render changes to.
background (str) – Character or string used for the background of the effect.
img_start_x (int, optional) – Where the image starts on the x axis. Defaults to None.
img_start_y (int, optional) – Where the image starts on the y axis. Defaults to None.
img_width (int, optional) – The width of the image. Defaults to None.
img_height (int, optional) – The height of the image. Defaults to None.
collision (bool, optional) – Whether or not the effect should collide with the image. Defaults to False.
show_info (bool, optional) – Whether or not to show snowflake information. Defaults to False.
- update_collision(img_start_x: int, img_start_y: int, img_width: int, img_height: int, collision: bool, smart_transparent: bool, image_buffer: Buffer = None)[source]¶
Function to set whether or not to visually see the snow collide with the ground or images if they are present
- Parameters:
img_start_x (int) – Start of the image on the x axis.
img_start_y (int) – Start of the image on the y axis.
img_width (int) – Width of the image.
img_height (int) – Height of the image.
collision (bool) – Whether or not the effect should collide with the image.
smart_transparent (bool) – not used …
image_buffer (Buffer, optional) – The image buffer in order to find collisions. Defaults to None.
- set_show_info(show_info: bool)[source]¶
Function to set whether or not to display information about the snow effect
- Parameters:
show_info (bool) – Whether or not to display information about the snow effect
- generate_snowflake(x: int)[source]¶
Generates a new snowflake at the given x position.
- Parameters:
x (int) – The x position to generate the snowflake at.
- is_colliding(x: int, y: int)[source]¶
Checks if a snowflake is colliding with the ground / snowflake at the given position.