Book Image

GameMaker Programming By Example

By : Brian Christian, Steven Isaacs
Book Image

GameMaker Programming By Example

By: Brian Christian, Steven Isaacs

Overview of this book

This book is excellent resource for developers with any level of experience of GameMaker. At the start, we’ll provide an overview of the basic use of GameMaker: Studio, and show you how to set up a basic game where you handle input and collisions in a top-down perspective game. We continue on to showcase its more advanced features via six different example projects. The first example game demonstrates platforming with file I/O, followed by animation, views, and multiplayer networking. The next game illustrates AI and particle systems, while the final one will get you started with the built-in Box2D physics engine. By the end of this book, you have mastered lots of powerful techniques that can be utilized in various 2D games.
Table of Contents (16 chapters)

Creating the enemies


The next step in our game will be to program the enemies and give them a simple AI. The first part of the process is to create an enemy sprite. Since we're going to have you create an enemy with a specific routine, you should either use the sprite provided in the example project or you should create a 32 x 32 enemy sprite with a single subimage that is intended to rotate and shoot two bullets, one out of each side. When you're done with creating the subimage, modify the mask as usual and also center the origin of the sprite. After this, create an enemy object and assign it the proper sprite.

Parenting in objects

GameMaker uses the object-oriented programming paradigm, as you've probably noticed by now. Most of what we do is in objects, and even the resources that aren't called objects are actually objects in terms of object-oriented programming. They just can't do what GameMaker objects do. So rooms are objects, backgrounds are objects, everything is an object. And what...