Book Image

GameMaker Game Programming with GML

By : Matthew DeLucas
Book Image

GameMaker Game Programming with GML

By: Matthew DeLucas

Overview of this book

<p>GameMaker: Studio is a popular game engine used to publish games to a variety of platforms. Although GameMaker: Studio's drag-and-drop functionality makes creating games simple and fast, utilizing scripts can really help organize and speed up GameMaker's workflow exponentially.</p> <p>This hands-on guide will help you build a strong foundation in programming in GameMaker Language by taking you through several example games. Knowledge gained by the end of the book can be applied so you can build your own line of exciting games.</p>
Table of Contents (17 chapters)
GameMaker Game Programming with GML
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preparing the game for obj_camera


Now that the basic view parameter variables have been covered, the camera object can be made. Only one new object resource needs to be created; this object resource will be named obj_camera. It will have a Create event and an End Step event. The Create event will mostly define variables, while the End Step event will be used to actually move the camera.

The Create event

As with many of the object resources previously created in this book, the Create event of obj_camera will define a variety of variables. The following script will be executed by the Create event:

/// Initializes variables for the camera.

// The index of the view that will be manipulated.
view_index = 0;

// The left most limit that the camera can move.
limit_left = 0;

// The right most limit that the camera can move.
limit_right = room_width;

// The top most limit that the camera can move.
limit_top = 0;

// The bottom most limit that the camera can move.
limit_bottom = room_height;

// The...