Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
GameMaker Programming By Example

You're reading from   GameMaker Programming By Example Master the development of 2D games by learning to use the powerful GameMaker Language and tools provided by the GameMaker: Studio workspace and engine!

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785887963
Length 212 pages
Edition 1st Edition
Arrow right icon
Authors (2):
Arrow left icon
Brian Christian Brian Christian
Author Profile Icon Brian Christian
Brian Christian
Steven Isaacs Steven Isaacs
Author Profile Icon Steven Isaacs
Steven Isaacs
Arrow right icon
View More author details
Toc

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

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime