A 2D Camera for AppGameKit T1 (Only tested on 1088).
Download from Here
Includes a Camera Trap
A configurable zone around player sprite that allows movement of the sprite without scrolling the screen.
Damping
Smoothly scrolls the tracked sprite into view (Configurable, use 5 as a starting point) Setting this value too low will allow the sprite to move off the screen as the camera will lag behind. Setting the value too high will cause the Camera to sharply snap to the tracked sprite.
Camera Limits
Allows setting of limits for camera movement in addition the tracked sprite can also be locked to the same limits.
Simple to Use.
Initialise the Camera :
Camera2DInit(offset x, offset y, damping , lock Sprite )
Offset x and y determine the top left location of the camera trap
Damping (as above)
Lock Sprite: 0 = false 1=true. If set to true the tracked sprite will not be allowed to move outside the camera limits.
Set the Camera Limits, Trap and debug Mode.
(Once the camera has been initialised the global variable Camera1 can be used to set the camera properties)
Camera1.trapSize.X = 1024 / 3 // Width of the camera trap
Camera1.trapSize.Y = 768 / 3 // Hight of the Camera trap
Camera1.debug = 1 // 0 = false, 1 = true , When turned on a transparent box will show //the trap area
Camera1.lookAhead.X = 0.0 // lookahead x ,y allow addition space in the moving direction, //normally used on small mobile screens
Camera1.lookAhead.Y = 0.0
Set The Camera:
Camera2DSet(spriteId,top x,top y,bottom x,bottom y)
spriteId The spriteId you want the camera to start at
top x Camera limit top X position
top y Camera limit top Y position
bottom x Camera limit bottom X position
bottom y Camera limit bottom Y position
Tell the Camera to follow a sprite:
In your main game loop after you have updated the player movement
Camera2DFollow(spriteId)
spriteId The Id of the sprite you want the camera to follow.
Additions:
Includes a simple Camera Demo that shows how to track a sprite with the camera. The demo also includes the Screen Shaker as its easier to see the effect within a mock game. To trigger the shaker move the player straight up to the top platform (you should see falling rocks and lots of shaking).
The TileMap lib is far from complete but it does include a couple of nice functions that will look a the tile data and create a smaller number of collision areas, rather than each tile having its own collision area.