Camera¶
- class Camera(size: pygame.math.Vector2)[source]¶
Bases:
object
Basic math for getting view of game world
- zoom¶
positive numbers “zoom out”, negative numbers “zoom in”
World units are equal to pixels at zoom level of 0.0
- __init__(size: pygame.math.Vector2)[source]¶
- centre(pos: pygame.math.Vector2)[source]¶
Immediately centre the camera on a world point
- clamp(rect: pygame.Rect)[source]¶
Move camera so that it is contained in the rect
Has same behaviour as pygame.Rect.clamp
- get_centre() pygame.math.Vector2 [source]¶
Get copy of the position
- get_rect() pygame.Rect [source]¶
Return Pygame Rect representing the visible area of the camera
- get_size() pygame.math.Vector2 [source]¶
Return vector of the size after zoom is applied
- render_offset() pygame.math.Vector2 [source]¶
Return vector for drawing offset
- set_target_position(pos: Optional[pygame.math.Vector2])[source]¶
Move camera to position over time. Pass None to clear.