Legacy:Functions/Map/Camera
From Spherical
< Legacy:Functions | Map
Following entities
- GetCameraPerson(): Get the name of the person the camera is attached to.
- IsCameraAttached(): Check if the camera is attached to a person.
- AttachCamera(person): Make the camera follow person.
- DetachCamera(): Stop the camera from following any person.
Camera position
- GetCameraX(): Get the map X coordinate the camera is focusing on.
- SetCameraX(x_pos): Set the X coordinate of the camera.
- GetCameraY(): Get the map Y coordinate the camera is focusing on.
- SetCameraY(y_pos): Set the Y coordinate of the camera.
Coordinate conversion
Coordinate conversion translates the current map position to screen coordinates based on the current camera position, and vice versa. Some functions (like checking obstructions) require map coordinates, while others (like image blitting) require screen coordinates. Both map and screen coordinates consider the top-left corner to be (0,0) and extend right-ward and down-ward for X and Y position, respectively.
- MapToScreenX(layer, x): Convert a map X coordinate to screen X.
- MapToScreenY(layer, y): Convert a map Y coordinate to screen Y.
- ScreenToMapX(layer, x): Convert a screen X coordinate to map layer X.
- ScreenToMapY(layer, y): Convert a screen Y coordinate to map layer Y.