Camera

Before you start, you will need a basic game engine with a character with at least one level.

Download what you need:

Basic Movement Engine or Platform Engine

 

Changing the size of your level.

Example Room Size

If your level isn't long enough for scrolling you can change the size of it.

Open your level.

Click the settings tab.

Change the Width and Height of your room until your level is big enough.

 

Adding a Camera to your Level

Once you have the size of your level set up, click the Views tab

Example View

Before you can use views in your level, you must enable them, if you don't views won't work.

Click the, Enable the use of Views check box.

You can have up to 8 views per level, make sure the first one is selected as shown, it will be by default.

Now tick, Visible when room starts.

Ticking this box will make the view show as soon as the level starts, if you want, you can turn a view on when you press a certain button or do something in the game, that's why there are several views but more on that in another tutorial.

 

Setting how much of the level you can see

The first thing to do is choose how much of the level the character can see, this is done in the Port on screen text boxes.

You should only have to change W and H, width and height, for an example, put 300.

 

Setting the size of the game window

The next set of text boxes, port on screen, determines how big the game window is, it's best to keep this the same size as the view in room, other wise, the graphics will stretch to fit in the window.

 

Making the camera follow your character

You want the camera to follow your character when it moves, to do this, all you have to do is select what object to follow.

In the Object Following drop down box, select your character.

If you have more than one of the object which the camera is following, you will get errors because it won't know which one to follow.

 

Setting how much the screen scrolls.

In the game, you want the screen to scroll as the character does, to get this, you have to set the Horizonal and Vertical as big as they can go.

Set Hbor and Vbor as 256.

Example Game Camera

Test your level and the camera will follow your character. You have to add the camera to every level you want it in otherwise there will be no camera.

 

Download working example

view_camera.gm6