Rain 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.rain_effect.RainEffect(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, intensity: int = 1, swells: bool = False, wind_direction: str = 'none')[source]¶
Bases:
BaseEffect
Effect to emmulate the look of rain
- __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, intensity: int = 1, swells: bool = False, wind_direction: str = 'none')[source]¶
Initialize the RainEffect class with given parameters.
- Parameters:
buffer (Buffer) – Effect buffer to push updates to.
background (str) – Character or string to use for the background.
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 hit the image. Defaults to False.
intensity (int, optional) – How intense should the rain be. Defaults to 1.
swells (bool, optional) – Where or not to increase and deacrease the intensity automatically. Defaults to False.
wind_direction (str, optional) – Which direction the rain should fall. Defaults to “none”.
- update_multiplier(val: int)[source]¶
Update the multiplier value that relates to shift amount.
- Parameters:
val (int) – multiplier value
- update_wind_direction(direction: str)[source]¶
Update the direction of the rain.
- Parameters:
direction (str) – Direction the rain should fall.
- update_intensity(intensity: int)[source]¶
Function to update the intensity of the rain.
- Parameters:
intensity (int) – The intensity of the rain.
- update_collision(img_start_x: int, img_start_y: int, img_width: int, img_height: int, collision: bool, smart_transparent: bool = False, image_buffer: Buffer = None)[source]¶
Function to set whether or not to visually see the rain collide with the ground or images if they are present. :param img_start_x: Where the image starts on the screen. :type img_start_x: int :param img_start_y: Where the image starts on the screen. :type img_start_y: int :param img_width: The width of the image. :type img_width: int :param img_height: The height of the image. :type img_height: int :param collision: Update collision variable. :type collision: bool :param smart_transparent: Update smart_transparent. Defaults to False. :type smart_transparent: bool :param image_buffer: The buffer that contains the image. Defaults to None. :type image_buffer: Buffer