Compound Parts - PAT:CMRA

For this example we'll create a simple camera - with a few buttons so that the camera can move around.

Unlike previous sections I'm not going to explain every line - if you've got this far I hope you can understand most of them by now anyway!

Instead you should download the COS file at this end of this article and the bits that are new will be explained.

This example COS file creates a Compound Object (which is mostly invisible - it uses the sprite file called 'blank.c16' which is a plain black 100x100 square).

On this Compound Object we have created 4 buttons (notice that they are from a different sprite file) which are direction arrows.

The other part is the camera part - for an overlay we have just used the blank sprite again, but you can be more imaginative and create an overlay that provides the illusion of scan lines on a screen.

The camera part has similar arguments to the other PAT: types, but the extra ones allow you to specify the size of area you want to view ... and the size of area you want the screen to be. If you alter these numbers you can produce a camera that shows things at half-size, double-size, 1-1 size or any other ratio you desire. For this example it is using a simple 1-1 ratio by keeping the view and camera sizes the same

This camera holds a location to look at within OV00 and OV01, and the buttons on the agent merely alter these values.
Notice the use of the SCAM command ... it is this that allows you to make future camera commands refer to a camera part rather than the game camera (which is responsible for showing you your window on the world). Once you have performed the SCAM you can then use any camera command to move the viewport around, and it will be updated on the camera part.

Have a look at the CAOS Language Guide ... there are other camera commands that can be used for great effect - such as ZOOM.

Downloads:   COS File