Utility¶
- angle_to(start_pos: pygame.math.Vector2, end_pos: pygame.math.Vector2) float [source]¶
Find the angle to another position.
- clamp(value: nqp.core.utility._V, min_value: nqp.core.utility._V, max_value: nqp.core.utility._V) nqp.core.utility._V [source]¶
Return the value, clamped between min and max.
- clip(surface, x, y, x_size, y_size) pygame.Surface [source]¶
Clip a subsurface from a surface.
- distance_to(start_pos: pygame.math.Vector2, end_pos: pygame.math.Vector2) float [source]¶
Find the distance to another position.
- get_direction(angle: float, move_distance: float) pygame.math.Vector2 [source]¶
Find the direction based on the angle and distance
- lerp(initial_value: float, target_value: float, lerp_fraction: float) float [source]¶
Linear interpolation between initial and target by amount. Fraction clamped between 0 and 1. >=0.99 is treated as 1 to handle float imprecision.
- percent_to_float(percent_string: str)[source]¶
Convert string representation of percent into a float
- previous_number_in_loop(start: int, loop_size: int) int [source]¶
If at max loop size, returns loop size -1.
- scene_to_scene_type(scene) nqp.core.constants.SceneType [source]¶
Take a Scene and return the relevant SceneType