O'Reilly logo

GameMaker Programming By Example by Steven Isaacs, Brian Christian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required