Game Cameras

1.Camera Screen Space

video-156662_1280

 

The Game Camera is possibly one of the most powerful entity in the vast amount of entities of game development.

 

The Game Pencil Engine takes a simple 2D approach to game cameras.

 

Up to 8 game cameras are able to be used in the Game Pencil Engine.

 

Game Cameras are reset once the game scene has been changed or the game resets.

 

Game Camera Ids start from zero like arrays(thus they range from 0 to 7).

2.Camera Functions

The Game Pencil Engine was created around these functions not being called within the rendering functions of your game. Unexpected results may occur if these are called during the render-state of GPE.

gpe.center_camera( cameraId, centerX, centerY)

-Centers the indexed camera[From 0 to 7] around the coordinates(centerX, centerY). In the event the position is off the screen the Game Pencil Engine automatically attempts to readjust it to stay within the scene boundaries.

 

gpe.disable_camera ( cameraId)

-Disables the indexed camera[ From 0 to 7].

 

gpe.enable_camera ( cameraId)

-Enables the index camera[ From 0 to 7].

 

gpe.move_camera(cameraId, newX, newY)

–Places the indexed camera[From 0 to 7] at the coordinates(newX, newY). In the event the position is off the screen the Game Pencil Engine automatically attempts to readjust it to stay within the scene boundaries.

 

gpe.setup_camera(cameraId, cameraX,cameraY, cameraW, cameraH);
-This function is used to place the location box of the camera(if enabled) on the screen.
-cameraId( From 0 to 7).

3.Using Multiple Cameras

Most games played use only one game camera(thus the reason only camera[0] is only enabled by default).

 

There are instances where you may wish to use multiple cameras:

  • Local multiplayer games with split-screen support
  • Games with emulated cameras within the game world.
  • Cutscenes which may want to show multiple parts of the scene at once.
  • Other advanced uses of graphic processing.

 

If you find yourself using any of the above, it is recommended to use multiple cameras with caution in regards to the game’s fps.

Suggest Edit