LHCamera Reference

Inherits from
LHCamera.h

Instance Methods

isActive

- (bool)isActive
Discussion

Returns wheter or not this camera is the active camera.

Declared In
LHCamera.h

setActive

- (void)setActive
Parameters
value

A value specifying if this should be the active camera.

Discussion

Sets this camera as the active camera.

Declared In
LHCamera.h

followedNode

- (Node *)followedNode
Discussion

Returns the followed node or nil if no node is being fallowed;

Declared In
LHCamera.h

followNode

- (void)followNode
Parameters
node

The node this camera should follow.

Discussion

Set a node that should be followed by this camera.

Declared In
LHCamera.h

restrictedToGameWorld

- (bool)restrictedToGameWorld
Discussion

Returns wheter or not this camera is restricted to the game world rectangle.

Declared In
LHCamera.h

setRestrictedToGameWorld

- (void)setRestrictedToGameWorld
Parameters
value

Set the restricted state.

Discussion

Set the restricted to game world state of this camera.

Declared In
LHCamera.h

setPosition

- (void)setPosition
Parameters
position

The new camera position.

Discussion

Set the camera position. The center of the view if the camera is active.

Declared In
LHCamera.h

setOffsetUnit

- (void)setOffsetUnit
Parameters
unit

The new camera offset unit. This value is multipled with the screen dimensions and added to the camera position.

Discussion

Set the camera view offset unit. This value is added to the camera position as an offset.

Declared In
LHCamera.h

getOffsetUnit

- (Point)getOffsetUnit
Discussion

Returns the camera unit offset.

Declared In
LHCamera.h

setImportantAreaUnit

- (void)setImportantAreaUnit
Parameters
unit

The new camera important area unit. This value is multipled with the screen dimensions.

Discussion

Set the important camera view unit. This value is multipled with the screen dimensions. The area is based on the center. Based on this area the camera position will be calculated based on the following node movement. This value is ignored when camera is not following a node.

Declared In
LHCamera.h

getImportantAreaUnit

- (Size)getImportantAreaUnit
Discussion

Returns the camera important area unit.

Declared In
LHCamera.h

setLockX

- (void)setLockX
Parameters
val

A boolean value specifying if camera should move on x axis.

Discussion

Set whether or not the camera should move on x axis. This value is ignored when camera is not following a node.

Declared In
LHCamera.h

getLockX

- (bool)getLockX
Discussion

Returns the camera x axis movement locking state.

Declared In
LHCamera.h

setLockY

- (void)setLockY
Parameters
val

A boolean value specifying if camera should move on y axis.

Discussion

Set whether or not the camera should move on y axis. This value is ignored when camera is not following a node.

Declared In
LHCamera.h

getLockY

- (bool)getLockY
Discussion

Returns the camera y axis movement locking state.

Declared In
LHCamera.h

setSmoothMovement

- (void)setSmoothMovement
Parameters
val

A boolean value specifying if camera should reach its important area smoothly.

Discussion

When an important area is set, and the following node has exist it or has changed direction, smooth movement will make the camera reach its new position in a non-snapping mode. This value is ignored when camera is not following a node.

Declared In
LHCamera.h

getSmoothMovement

- (bool)getSmoothMovement
Discussion

Returns if the camera is trying to reach the important area smoothly.

Declared In
LHCamera.h

zoomByValueInSeconds

- (void)zoomByValueInSeconds
Parameters
value

Set zoom value that will be added/substracted from the currect camera zoom level.

seconds

The time needed for the camera to reach the zoom value specified.

Discussion

Set the camera zoom level by adding the value to the current zoom level. Only works if the camera is active.

Declared In
LHCamera.h

zoomToValueInSeconds

- (void)zoomToValueInSeconds
Parameters
value

Set new zoom value of the camera.

seconds

The time needed for the camera to reach the zoom value specified.

Discussion

Set the camera zoom level. Only works if the camera is active.

Declared In
LHCamera.h

getZoomValue

- (float)getZoomValue
Discussion

Get the current camera zoom value.

Declared In
LHCamera.h

setZoomValue

- (void)setZoomValue
Parameters
value

Set new zoom value of the camera.

Discussion

Set the camera zoom value without any delay.

Declared In
LHCamera.h

lookAtPositionInSeconds

- (void)lookAtPositionInSeconds
Parameters
gwPosition

The position the camera will look at. A point value in Game World Node coordinate.

seconds

The time needed for the camera to reach the position value specified.

Discussion

Makes the camera to look at a specific position by moving from the current or followed object position to this new position in a period of time. You should not use this method to move the camera manually. Use setPosition: instead. This method should be used only when you want to make the player aware of something in the game world, like a checkpoint it needs to reach.

Declared In
LHCamera.h

lookAtNodeInSeconds

- (void)lookAtNodeInSeconds
Parameters
node

The node the camera will look at. A CCNode* derived object (e.g LHSprite, LHNode, ...).

seconds

The time needed for the camera to reach the position of the node specified.

Discussion

Makes the camera to look at a specific node by moving from the current or followed object position to the position of the node in a period of time. You should not use this method to move the camera manually. Use setPosition: instead. This method should be used only when you want to make the player aware of something in the game world, like a checkpoint it needs to reach.

Declared In
LHCamera.h

resetLookAt

- (void)resetLookAt
Discussion

Resets the lookAt position by moving the camera back to its original position before the camera was made to lookAt or to the followed object position. The reset is instant.

Declared In
LHCamera.h

resetLookAtInSeconds

- (void)resetLookAtInSeconds
Parameters
seconds

The time needed for the camera to move back from the lookAt position to its original or followed node position.

Discussion

Resets the lookAt position by moving the camera back to its original position before the camera was made to lookAt or to the followed object position in a period of time.

Declared In
LHCamera.h

isLookingAt

- (bool)isLookingAt
Discussion

Returns whether or not this camera is currently looking at something. A boolean value.;

Declared In
LHCamera.h

setUsePinchOrScrollWheelToZoom

- (void)setUsePinchOrScrollWheelToZoom
Discussion

Sets the camera to zoom on pinch gesture on iOS or scroll wheel on Mac OS when active. The zoom will be centered on the followed node or on the center of the pinch.

Declared In
LHCamera.h

usePinchOrScrollWheelToZoom

- (bool)usePinchOrScrollWheelToZoom
Discussion

Returns whether or not this camera is zooming on pinch gesture on iOS or on scroll wheel on Mac OS.

Declared In
LHCamera.h
Last updated: 2015-2-12

Back to top

Copyright © VLADU BOGDAN DANIEL PFA.