-
Notifications
You must be signed in to change notification settings - Fork 0
Home
You must call all functions with a colon, NOT A PERIOD. For example:
CameraAPI.CameraFollowPosition(pos) -- Wrong
CameraAPI:CameraFollowPosition(pos) -- RightTo access enums, you simply add CameraAPI. (or whatever you named a variable containing CameraAPI) at the start like this:
CameraAPI.CameraMode.FREE -- enum name: CameraMode.FREEvoid CameraFollowPosition(Vector pos, int duration = -1, boolean force = true)
Makes camera follow provided position for given amount of frames
pos: determines the position camera will follow
duration(optional): determines amount of frames that camera will follow given position. If duration value is below 0, camera will follow the position infinitely. Default value: -1
force(optional): determines if camera should follow provided position when it's already following position/entity provided by CameraFollow...() functions. Default value: true
CameraAPI:CameraFollowPosition(Vector(320, 280)) -- will make camera snap to coordinates (320, 280) and stay there infinitely
CameraAPI:CameraFollowPosition(Game():GetRoom():GetCenterPos(), 300) -- will make camera snap to the room center and stay there for 300 in-game frames(about 10 seconds)void CameraFollowEntity(Entity entity, int duration = -1, Vector offset = Vector(0, 0), boolean force = true)
Makes camera follow provided entity with provided offset for given amount of frames
entity: determines the entity camera will be following
duration(optional): determines amount of frames that camera will be following provided entity. If duration value is below 0, camera will follow the position infinitely. Default value: -1
offset(optional): determines offset from the provided entity's position. Default value: Vector(0, 0)
force(optional): determines if camera should follow provided entity when it's already following position/entity provided by CameraFollow...() functions. Default value: true
CameraAPI:CameraFollowEntity(Isaac.GetPlayer()) -- will make camera follow player infinitely
CameraAPI:CameraFollowEntity(Isaac.FindByType(EntityType.ENTITY_MONSTRO)[1], 150) -- will make camera follow first spawned Monstro in the room for 150 in-game frames(about 5 seconds)int GetCameraTimeout()
Returns amount of remaining frames for camera to follow specific position or entity. Return value being -1 means, that camera is following position/entity provided by CameraFollow...() functions infinitely. Value also will be -1 if IsCameraLocked() returns true
If return value is 0, camera will stop following position/entity provided by CameraFollow...() functions on this game update.
void SetCameraTimeout(int value)
This function will do nothing if IsCameraLocked() returns true
Sets current camera timeout to provided value. Setting it to -1 will make camera to follow position/entity infinitely. Setting it to 0 will stop camera from following any position/entity provided by CameraFollow...() functions on next game update.
CameraMode GetCameraMode()
Returns current camera mode. For details see CameraMode enum.
void SetCameraMode(CameraMode mode)
Sets camera mode to provided value. For details see CameraMode enum.
Vector GetCameraWorldPosition()
This is not the same as GetCameraFollowPoint().Position!
Returns screen center coordinates transformed to world coordinates. I've made this function from decompiled Isaac.WorldToScreen() function (thanks Guantol for making LuaDecomps), so it may have minor inaccuracy that deppends on your screen resolution.
table GetCameraFollowPoint()
Returns table with 3 possible fields:
Position - position, that camera is currently following.
Entity - entity, that camera is currently following. If camera isn't following an entity, this field will be nil.
PositionOffset - offset of the position of the entity, that camera is currently following. If camera isn't following any entity and istead following a position, this field will be Vector.Zero.
All of the fields will be nil, if IsCameraLocked() returns true for compatibility purposes.
Note that this function always returns a table, so you only need to check fields!
boolean IsCameraLocked()
Returns true if camera is currently following it's game logic, false otherwise.
WARNING! This function doesn't track camera position changes through REPENTOGON Camera class functions!
void SetCameraLocked(boolean value)
Locks or unlocks the camera from altering it's position through CameraAPI.
WARNING! This function doesn't affect changing camera position through REPENTOGON Camera class functions for compatibility purposes!
CameraMode.ROOM_BORDER = 1
CameraMode.FREE = 2ROOM_BORDER: with this CameraMode camera has standart position limit, which is room borders, that means it will try to stay within them.
FREE: with this CameraMode camera has no limits, that means it will not alter following position in any way.