Get gaming faster with the official guide to GameMaker:Studio GameMaker: Studio allows you to create your own games, even withzero coding experience, and GameMaker: Studio For Dummies isa complete guide to the ins and outs of the program. Create thegame you've always wanted to play in record time and at a fractionof the cost of traditional game development methods. You'll havethe flexibility to develop 2D games for Android, iOS, desktops, andthe Web. Gain a professional perspective on this revolutionary pathto game creation and publishing. Using GameMaker: Studio may feel like play, but it's a serioustool that allows you to create, design, develop, and publish yourvery own games. With the push of a button, the program producesreal, executable code for your very own "app store"-ready 2D game,complete and ready for market. GameMaker: Studio For Dummiesprovides complete and accurate information on how to create classicgames and special effects, written in the characteristicallyeasy-to-read Dummies style. Topics include: * An overview of Studio, and how to get started * The basic tools and techniques at the core of your design * Advanced techniques for more seasoned game designers * An inside look at what the premium upgrades have to offer GameMaker: Studio makes game design 80% faster than coding fornative languages, so you can take your game from concept to marketin a matter of weeks. Why waste time and money doing it any otherway? Whether you already have great ideas or just want to dabble,GameMaker: Studio For Dummies is the guide that will takeyou straight to guru status.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
GameMaker: Studio For Dummies®
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright © 2014 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and may not be used without written permission. GameMaker: Studio is a trademark of YoYo Games, Ltd. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit www.wiley.com/techsupport.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2014935513
ISBN 978-1-118-85177-7 (pbk); ISBN 978-1-118-85210-1 (ebk); ISBN 978-1-118-85215-6 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
Table of Contents
About This Book
Icons Used in This Book
Beyond This Book
Where to Go from Here
Part I: Getting Started with GameMaker: Studio
Chapter 1: Introducing GameMaker: Studio
Dragging and Dropping Your Way to Making a Game
Understanding the GameMaker Language
Publishing Games to Different Platforms
Highlighting the Key Features of GameMaker: Studio
Creating a Game, Step by Step
Chapter 2: Discovering GameMaker: Studio Features and Tools
Navigating the GameMaker Interface
Pump Up the Volume: Adding Sounds to Your Game
Making Things Sparkle with Sprites
Loading and creating Sprites
Populating Your Game with Objects
Placing Objects in the Game Room
Creating a Room
Putting your Objects in the Room
Part II: Basic Tools and Techniques
Chapter 3: Creating Events
How to Add an Event to an Object
The Create Event
The Destroy Event
The Alarm Event
The Step Event
The Collision Event
The Mouse Event
The Other Event
The Draw Event
The Key Events
The Asynchronous Event
Chapter 4: Adding Actions to Events
How to Assign an Action to an Object
Move Directional Actions
Chapter 5: Working with Views
Using Speed and Movement with Views
Creating a Room with a View
Using a Controller Object to Move the View
Reaching the End of the Room
Positioning the Score Display in a Room with a View
Setting Object Boundaries for Rooms with Views
Destroying Instances When They Leave a Room
Shooting Guided Bullets in a Room with Views
Creating Enemy Planes in a Room with Views
Creating Patterns of Enemy Planes in a Room with Views
Transitioning to the Next Room
Chapter 6: Working with Time Lines
Creating a Time Line
Creating a Time Line Object
Creating the Time Line Room
Transitioning to the Next Room with Time Lines
Adding a Boss Battle to a Time Line
Creating the boss Sprite
Creating the boss Object
Adding the Boss to the Time Line
Part III: Creating Special Effects
Chapter 7: Using Actions to Create Special Effects with Particles
Coding a Button to Trigger the Particles
Using the Create Effect Action
Using the Particle Actions and Emitters
Creating puffs of smoke
Creating the Catherine wheel firework
Creating an emitter for the firework
Chapter 8: Coding Special Effects with Particles
Coding the Particle System and the Smoke Trail
Coding the Simple Firework Effect
Coding burst emitters
Coding stream emitters
Coding Complex Particle Effects
Chapter 9: Using Surfaces to Create Effects
Understanding the Surface Function
The application Surface
Creating Shadows with Surfaces
Using Decals with Surfaces
Lighting Effects with Surfaces
Creating a flashlight effect
Adding darkness to the Surface
Using Surfaces as a View
Setting up the Room and an Object for Surface Views
Creating the Surface View effect
Chapter 10: Applying Scaling
Configuring the Global Game Settings
Scaling to the Window
Scaling to best fit
Scaling the View
Scaling on mobile devices
Scaling with Draw GUI Events
Maximizing the GUI
Hiding the letterbox
Placing GUI elements to create a heads-up display
Part IV: Coding Physics, Mobile Controls, and More
Chapter 11: Coding with GameMaker Language
Displaying Sub-Images with Code
Randomly displaying sub-images
Sorting sub-images by index
Adding Code to Objects
Coding keyboard controls
Coding an Object with collisions and Step Events
Coding a Score Display and Lives
Coding to Start and End Games
Introducing the game
Ending the game
Chapter 12: Using Physics
Defining the physics properties
Creating a fixture
Adding Movement to an Object with Physics
Example code for an Up Keyboard Event to apply local force
Example code for Left and Right Keyboard Events
Adding Physics to Rooms
Physics and Shooting Bullets
Defining bullets to work with Physics
Coding the ship to shoot bullets
Chapter 13: Creating Controls for Mobile Devices
Putting Your Game on a Mobile Device
Using an emulator
Putting your game online
Adding Simple Touch Controls
Understanding virtual keys
Creating virtual keys
Adding Sprites to virtual keys
Adding Swipe Controls
Pinching and Zooming
Creating Analog Sticks for Mobile Devices
Drawing the sticks onto the GUI script
Making the player move
Shooting with the analog stick
Chapter 14: Saving and Loading
Understanding the File System
Understanding INI Files
Using Real Values to Save Game Options
Making a button for the background music
Making a button for the sound effects
Using String Values to Save Game Options
Mapping the Gameplay Keys
Resetting the Default Keys
Part V: The Part of Tens
Chapter 15: Ten Tips for Game Developers
Developing Cross-Platform Games
Knowing Your Audience
Monetizing Your Games
Choosing Your Game Genre
Making Your Game User-Friendly
Testing Your Game
Considering Limitations for Mobile Devices
Expanding Your Opportunities
Chapter 16: Ten (Or So) Frequently Asked Questions about GameMaker: Studio
What Types of Games Can I Make with GameMaker: Studio?
Can I Run GameMaker: Studio on a Mac?
How Do I Recover My License Key?
How Do I Include Advertising in My Game?
How Do I Activate In-App Purchases?
What’s Involved with Publishing My Game?
When Is a New Feature Coming Out?
Where Can I Get More Game-Making Tips and Tricks?
About the Author
More Dummies Products
Table of Contents
My interest in GameMaker: Studio started in the summer of 2013. I was scrolling through Twitter when a buddy of mine mentioned using GameMaker to make a game. So, of course, I had to check it out. I was immediately hooked on the idea of creating games without needing to know how to code. I read through some of the tutorials and got a couple of basic games to work, and soon enough I found myself coding. From there, it was only a matter of time before I realized that I wanted to write a book on GameMaker: Studio.
I hope you’re as excited as I am about creating video games. This book provides a ton of procedures on how to do everything from creating basic movements to creating some very special effects. I also provide overview concepts on how different parts of the game fit together. My hope is that you take the concepts you learn here and apply them to your own game. Who knows? Maybe one day we’ll be playing each other’s games on our favorite consoles and devices.
This book shows you how to make video games, quickly and easily. You make games geared toward PC and mobile devices with the possibility of expanding to consoles. You create different effects that you can apply to your own games. You find out all about Events and Actions and Sprites and Objects and Instances and Scripts and Rooms and Targets… . I could go on and on. There is an absolute ton of information packed into these pages.
If you enjoy reading through tutorials, written in a clear manner, full of details, you’ll appreciate GameMaker: Studio For Dummies. Much of the material I present here is stuff I learned from the GameMaker tutorials. But it was slow and hard going and I made a ton of mistakes. That’s where this book comes in to play: I’m sharing with you the secrets and details necessary to make the tutorials work, so that you can use them on your own games.
GameMaker: Studio For Dummies is modular — you don’t have to read straight through the book from Chapter 1 to the end. You can skip around and read the sections you’re most interested in. I include plenty of cross-references, so you won’t feel lost. I explain concepts a couple times in a couple different ways. That way, you can apply lessons learned in different situations. That should provide a solid foundation from which you can use GameMaker: Studio.
In writing this book, I made a few assumptions about you as the reader:You’ve probably been playing video games your entire life and now you want to make games. You want to make shooters, roguelike, and scrolling platform games.You want to play games on your iOS and Android devices.You may be envisioning getting your own Sony Developers License so that you can make games for the PS4 and Vita using GameMaker: Studio. Before you hit the big time, you need to start off slow, and that’s why you most likely already downloaded the free version of GameMaker, if not the paid edition.You may or may not know the first thing about code, but if you do, you’re one step ahead of the game. If you don’t know how to code, you want to learn.You’ve already gone through some of the in-software tutorials. The first couple of tutorials were easy enough, but when you tried some of the more complex tutorials, well, that’s when things got messy fast. At least, that’s what happened to me. And that’s why I wrote this book. Much of this book has you opening the in-software tutorial files, but I provide you the missing information, the step-by-step instructions that you want and deserve.
Basically, I’m envisioning you to be a go-getter who’s ready to make and play some games.
I use several icons throughout this book to help you understand GameMaker: Studio. The following is an explanation of each of the icons.
Whenever I provide information that’ll help you do something easier, faster, or better, I mark it with the Tip icon.
I still want to write a For Dummies book in which I can write a warning as to when pirates are about to attack, but that hasn’t happened yet. Instead, anything marked with the Warning icon has to do with your game crashing — as in, make sure to do or not to do something, so that your game doesn’t crash.
Whenever I remind you of something that I’ve already covered elsewhere, or tell you about something you should commit to memory, I mark it with the Remember icon.
The Technical Stuff icon mainly refers to details on code. You can skip anything marked with this icon, but I hope you read this stuff because it can help you grow as a developer.
In addition to the material in the print or e-book you’re reading right now, this product also comes with some access-anywhere goodies on the web. Check out the free Cheat Sheet at www.dummies.com/cheatsheet/gamemakerstudio for helpful information, all provided in a concise, quick-access format. You can also find articles online that build on the material you find in this book. Go to www.dummies.com/extras/gamemakerstudio for these informative articles.
I could have written a 700-page book to cover everything that you can do with GameMaker: Studio. In fact, I’ve written several extra tutorials, which you can find at www.gamemaker-tutorials.com.
On the YoYo Games website (http://www.yoyogames.com), you can find developer resources, support, and forums where you can ask and answer questions. You can also find a showcase of games that people have made using GameMaker. There’s a lot of cool stuff there — I recommend that you check it out if you haven’t already.
Like all authors, I would love it if you read this book from cover to cover, writing notes in the margins, highlighting passages, and dog-earing pages for quick reference later. Alas, you probably just want to know how to add virtual keys for mobile devices (see Chapter 13), or how to make an explosion look really cool (see Chapters 8 and 9). In that case, you can jump to those chapters. But if you get lost, you can start from the beginning to get the core concepts of what it takes to make a GameMaker game.
You may be tempted to skip Chapter 1, thinking it’s all fluff, but it’s not. In Chapter 1, I provide a procedure on how to choose a Target for a game. That’s very important information, especially if you want to play your game in a browser and not on Windows.
See how I did that? I included a reference in the Intro, to get you reading Chapter 1, and now you’ve taken the next step to create, publish, and play your video games.
For Dummies can help you get started with lots of subjects. Visit www.dummies.com to learn more and do more with For Dummies.
In this part …Get to know GameMaker: Studio.See how Sounds, Sprites, Objects, and Rooms work together.
In This Chapter
Coding without coding using Actions
Coding by coding with GameMaker Language
Getting your game into players’ hands
Identifying the major features of GameMaker: Studio
Looking at the main steps of creating a game
GameMaker: Studio software, from YoYo Games, is a game development tool that enables you to make video games. At the Game Developers Conference (GDC), I had an opportunity to meet with key players from YoYo Games. I saw firsthand the level of excitement this team from Dundee, Scotland has. It’s as if each of them embodied the spirit of a magical dragon, circling high overhead a misty mountaintop, ready to breathe down green flames of magical energy to level up all game developers with enhanced game-making attributes.
All game developers can benefit from GameMaker: Studio. Whether you’re a professional developer looking to enter the videogame community, or a university student interested in breaking into the videogame field, or a 10-year-old with no coding experience at all, GameMaker: Studio has the tools you need to make your vision a reality.
When I met with members of the YoYo team during GDC, I walked away with the feeling that this is a team with a dream. While I spoke to them, in the background, they had a PS4 setup running games made with GameMaker. They were telling me that it’s only a matter of time before everyone with a PS4 will be able to purchase and download those games. These are exciting times when a person with a Sony developers license can make her own games, whether it be from the office or the kitchen table, and then play it on a major console.
YoYo Games sees a day when any self-starter, of any age, can make a game with GameMaker: Studio, play it on his Nintendo 3DS, show it to his friends, and then possibly put it up for sale on the eShop. This is the direction we, as a gaming community, are headed: Independent developers have a spotlight shining on them, and it’s time to show the world what you can do.
As you start to think about your own possibilities for making games, keep these words of inspiration fresh in your mind:Start with the free version of GameMaker: Studio, and then keep growing and adding on as you make your way to becoming a professional.Hard work is what it’s all about — you’ll get out of it what you put into it.Include your own special touch in each of your games to make them unique and special.You can work your way up in the game development industry. Start out as a tester and then climb the ladder to becoming a developer.You don’t have to join a big company anymore to make a living making games. You just need the passion and desire to make the best game you can. The exploding indie scene opens game development up to everyone.
YoYo Games is looking forward to seeing the games you make so it can feature them on www.yoyogames.com. The YoYo Games website has a Showcase of games, along with YoYo Labs, where you can find open-source games. It also has a lively community in the forums and Help pages. Who knows? One day you might even see your game available for sale on your favorite console or handheld device!
You can make games with GameMaker: Studio without knowing code! That’s because GameMaker uses the drag-and-drop Actions (see Chapter 4). You use Actions to tell GameMaker how, what, when, and where you want something to happen during your game. When you create an Action, GameMaker creates the code for you in the background. For example, say you create an Action so that when the player presses the spacebar, she shoots bullets from her plane. When you make that Action, GameMaker creates the code that causes the plane to shoot a bullet when the player presses the spacebar. In that way, using the drag-and-drop Actions enables the non-developer to develop code.
The drag-and-drop Actions are also good for developers who do know how to code but want a quick and efficient way to write large blocks of code. For example, a developer could sit down and write out the code by hand, which can be timely and can lead to typos and errors. Or, she can use the drag-and-drop Actions to create those same blocks of code, which can take seconds instead of hours.
The drag-and-drop Actions provide a quick and easy way to create code. But you should start your game-making adventure with an open mind for learning how to code because, ultimately, it will benefit you and your games. Plus, by learning code, you gain a better appreciation for how the Actions work.
I’m not a developer, but I’m familiar enough with code that I can tweak existing code. Having this level of familiarity with how code works give you some background knowledge on what you’re doing when you drag and drop an Action.
If you’re a professional developer, and you want to write specific code for your own specific means, then GameMaker: Studio features a code-editing tool that most professional game developers should appreciate. Part IV of this book dives into the GameMaker language — it’s filled with example code, including working with physics and controls for mobile devices. Chapter 14 includes sample code for saving game configurations such as muting the sound or customizing the game keys.
As of this writing, you can install GameMaker: Studio on a PC or on a Mac with a Windows emulator, but that doesn’t mean you’re stuck making only games for Windows. Oh no, my friends, that’s far from the truth. When you’re ready to invest in the Professional or Master Collection version of GameMaker: Studio, you open yourself up to a world of platforms on which you can publish your game.
Figure 1-1 shows the drop-down list showing the different platforms to which you can target your game.
Figure 1-1: You have lots of options for where to publish your game.
If you don’t see your favorite platform on this list, it’s probably just a matter of time before it appears.
If you’re wondering why you don’t see PS4 or Vita in Figure 1-1, that’s because you need to be a licensed Sony developer for that option to appear.
To publish a game to a specific platform, follow these steps:From the icon menu, click the Target drop-down list (refer to Figure 1-1).
The Target options appear.Choose the platform you want to play your game on (for example, HTML5, if you want to be able to play it in a browser, such as Chrome or Firefox).
The chosen platform appears in the Target field.Choose File⇒Create Application.
A navigation window opens, allowing you to choose where to save the files. GameMaker names the file for you.Navigate to where you want to save the files, and then click Save.
GameMaker saves the appropriate files for the platform you chose, as shown in Figure 1-2.
Figure 1-2: The saved game folder structure and files for HTML5 games.
Now you can take these saved games files and folders and use them to upload to a website, which is great for HTML5 games. I use FTP software such as FileZilla (https://filezilla-project.org) to do that.
You can update the favicon file to your own icon. The favicon icon appears in the tabs of most web browsers.
GameMaker: Studio is so feature-rich, with such a multitude of tools, that I could write ten books on the subject! This book is excellent for those who want to learn what an Object is, and how Objects relate to Instances, and how you can assign Events and Actions to Objects to make them do things, like create a flower blossoming into a beautiful display of color, and then have the player blow it all up. You know, fun stuff like that. Objects and Actions are covered in detail in Chapters 3 and 4, respectively.
The interface for GameMaker: Studio is based on a series of windows. When you first open the software, you see a New Project window, from which you can do several things, such as open a tutorial, a demo, or a saved project, or start an entirely new project. When you start working on a project, the main window appears with a Resource tree, main menu, icon menu, and compile window. (I go into detail on each of these in Chapter 2.)
Another critical feature of GameMaker: Studio is the robust coding window, complete with color coding to highlight text. I discuss this in detail in Chapter 11. YoYo Games is planning an upgrade to this code window so that it supports tabs. This feature is not available as of this writing, but it should be out by the time you’re reading this book.
The steps I take to create a game are the same approach I use for most any creative project. First, you have to plan. Then you have to plan some more.
Here’s a quick list of action items I take before creating a game:Create an outline of the game, complete with objectives, characters, and game type.Think about how each level of the game will play.
Too often, developers create an awesome first and second level, only to run out of ideas for consecutive levels.Gather your assets, including images for Sprites, text, and any other resources you need for your game, such as music and sound effects.As you create your game based on your outline, start testing each new aspect.Test the game some more.Finally, test your game.
Seriously. You can’t test enough.
In This Chapter
Getting acquainted with the interface
Adding Sounds to your game
Making things pretty with Sprites
Bringing your game to life with Objects
Putting your Objects in Rooms
In this chapter, I provide a broad overview of some of the most used features and tools of GameMaker. That includes the interface, Sounds, Sprites, Objects, Actions, and Events. I go into much more detail on Actions and Events in the following chapters, but here I show you how to get started with creating and loading Sprites, adding music as a resource, and creating an Object that you can place in a Room. Buckle up, folks — this ride is about to start!
The basic work area within GameMaker consists of several sections. These sections are laid out in an organized manner to form the interface from which you work. You see a main menu along the top and an icon menu directly below that; these two menus provide separate ways of, say, creating a Sprite, loading a Sound, creating an Object, and so on. The icon menu is where you can find the Target drop-down list, which is where you tell GameMaker which platform you want to publish to, such as HTML5, Android, iOS, and so on (see Figure 2-1).
Along the left pane, you can find the Resource tree, which contains a quick list of resources, including Sprites, Sounds, Backgrounds, Objects, Rooms, and more. The bottom pane consists of a Compile window, which blasts into life when you run the game (meaning, when you run the game, you can watch GameMaker compile the game through a series of lines of text).
I tend to keep the Compile window closed while I’m working just to save screen space; however, if you have a large screen, you may find it useful when debugging and setting up extra Target modules, such as Android.
If you’re working from a tutorial, in the right pane you see the tutorial window. Figure 2-1 highlights the various parts of the interface.
When you create a new Object, or a Sprite, or a Room, or what have you, a new floating window appears. This floating window could contain several tabs of configurations, or it could have radio buttons, text fields, drop-down icons, drag-and-drop icons, and more. It’s within these floating windows where you do the majority of your work.
Figure 2-1: The GameMaker interface.
Sounds make up a large part of games these days. Everything from moody background music that builds as the player anticipates a challenging boss battle, to explosions, bullets firing, a character jumping (sproing!), and more.
To add a Sound resource to GameMaker, follow these steps:Choose the icon that looks like an old-fashioned stereo speaker (see Figure 2-2).
The Sound Properties window opens.
Figure 2-2: Click this icon to create a new Sound.
Figure 2-3: The Sound Properties window.
You hear the Sound when you click Play and it continues to play until you click the Stop button.You can edit the Sound by clicking the Edit Sound button (refer to Figure 2-3).
You need to configure an external sound editor to work with GameMaker in order to edit a Sound. Read on for instructions on how to do this.Click OK to save and close the Sound Properties window.
You can configure external editors to work within GameMaker. This includes sound editors, image editors, and code editors. To configure an external editor to work in GameMaker, follow these steps:From the main menu, choose File⇒Preferences.
The Preferences window appears.Click the Editors tab (shown in Figure 2-4).
Figure 2-4: The Editors tab of the Preferences dialog box.
Your options are Code Editor, Image Editor, SWF Viewer, and Sound Editors (for WAV files or MP3 files).
A navigation window opens from which you can navigate to and select the editor you want on your PC.Click OK to save and close the Preferences window.
A Sprite is an image, or a series of sub-images, that you assign to Objects. You can use Sprites to represent Objects in the game, such as the player (a ship or a character), explosions, walls, score displays, or anything you want in your game.
When a Sprite consists of a series of images, those images are known as sub-images, and they play continuously, as if they were mini-movies. That can give the appearance of a plane’s propellers rotating, an animated explosion, and so forth. Each sub-image within a Sprite is named consecutively (image 0, image 1, image 2, and so on), as shown in Figure 2-5.
Figure 2-5: The Sprite Editor showing sub-images.
Just as in programming, which starts counting at 0, the sub-image numbering starts at 0 as well.
If you don’t want the Sprite to play continuously, you can tell GameMaker to display a specific sub-image of your choice. You can even tell GameMaker to choose a sub-image at random (see Chapter 11).
The remainder of this section coversLoading and creating Sprites: You can do this a few ways, including using the main menu, the icon menu, or the Resource tree.Editing Sprites: You can do everything from adding the final detail to an already loaded Sprite to creating a new Sprite from scratch.Configuring Sprites: Sprites have their own properties, which you can set to affect their behavior during a game.
To load a Sprite that already exists, follow these steps:Click the icon that looks like Pac-Man from the icon menu (see Figure 2-6).
Figure 2-6: Click this icon to create a new Sprite.
The Sprite Properties window appears (see Figure 2-7).
Figure 2-7: The Sprite Properties window.
A navigation menu opens from which you can find an image on your computer.
To create a new Sprite from scratch, follow these steps:Click the icon that looks like Pac-Man from the icon menu (refer to Figure 2-6).
The Sprite Properties window appears (refer to Figure 2-7).Click the Edit Sprite button in the Sprite Properties window (refer to Figure 2-7).
The Sprite Editor window appears (see Figure 2-8).
Figure 2-8: The Sprite Editor window.
The Create a New Sprite dialog box appears (see Figure 2-9).
Figure 2-9: The Create a New Sprite dialog box.
A new Sprite, which consists solely of a transparent background at this point, appears in the Sprite Editor. You can now double-click this Sprite to open the image editor from which you can actually draw the Sprite.
To create a sub-image, you can choose one of the Create an Empty Image icons in the Sprite Editor (see Figure 2-10) to add the sub-image either before the current one or at the end. A new, blank sub-image appears in the Sprite Editor.
Figure 2-10: The Sprite Editor with three sub-images.
GameMaker has a built-in Image Editor (see Figure 2-11) that you can use to edit Sprites. To access the Image Editor, click Edit Sprite from the Sprite Properties window. Then double-click the image that you want to edit.
I don’t cover the Image Editor in this book, but the in-software manual goes into detail on it. Just press F1 in GameMaker to access the manual. Then choose the Index, search for “image editor,” and then choose Display at the bottom of the window.
Figure 2-11:GameMaker’s Image Editor for Sprites.
When you have your Sprite looking the way you want it, you can configure the Sprite with different properties. This includes placing the Origin, setting the Collision Checking (which includes modifying the Mask), and using the Texture Settings. I go into detail on each of these configurations in the following sections.
The default anchor point, which is considered the Origin, is the top-left corner of a Sprite. GameMaker uses the Origin as a point of reference for rotating, scaling, and so on (for example, turning the image around when it bounces off a wall).
While in the Sprite Properties window, when you click Center (see Figure 2-12), you’re telling GameMaker to use the center of the Sprite as the anchor point (that is, the Origin). Chapter 6 provides a good example of working with the anchor point, in the section on creating the boss Sprite.
Figure 2-12:Click Center to set the anchor point of the Sprite in the center.
The Collision Checking settings are found in the middle of the Sprite Properties window (see Figure 2-13). Collision Checking refers to how the Object (an Object with the Sprite loaded) reacts when colliding with other Objects. You can select the Precise Collision Checking box (refer to Figure 2-13) for more accurate collision detection, but this could potentially slow down the game. You can also modify the Mask from the Sprite Properties window, as discussed next.
Figure 2-13: The Collision Checking settings.
If your Sprite has sub-images, you can assign a separate Mask to each sub-image. To toggle this option, select the Separate Collision Masks in the Sprite Properties window (refer to Figure 2-13).
To set the Mask, follow these steps:In the Sprite Properties window, click the Modify Mask button (refer to Figure 2-13).
The Mask Properties window appears (see Figure 2-14).
Figure 2-14: The Mask Properties window.
If you select the Separate Collision Masks check box, you can set the Alpha Tolerance. The higher you set the tolerance, the more the partially transparent pixels are not affected by the Mask. Pixels become transparent as the Sprite transitions between sub-images. It’s during these transitions that the Alpha Tolerance comes into play.
By turning on Separate Collision Masks, you significantly increase the workload for GameMaker to run your game, which could cause performance issues.In the Bounding Box section, select Automatic, Full Image, or Manual.
If you select Automatic, GameMaker does its best job of forming a Mask around the Sprite; if you select Full Image, GameMaker selects the entire image, including the transparent background; and if you select Manual, you can configure the settings yourself by typing in values in the Left, Right, Top, and Bottom fields.In the Shape section, set a more precise Mask shape by choosing Precise, Rectangle, Ellipse, or Diamond.
If you select Precise, GameMaker does its best to set the Mask exactly against the pixels. If you choose Rectangle, Ellipse, or Diamond, GameMaker creates a Mask based on the chosen shape.
When you select Precise, you significantly increase the workload for GameMaker to run your game (even more so than using a separate collision mask), which could cause performance issues.Click OK to save and close the Mask Properties window.
In Chapter 8, you can find information on how to use fixtures instead of collision Masks, for when you want to make a physics-based game.
The Texture Settings, and in particular the Texture Group, can be useful when you start making very large games and you need to keep track of many different resources. Essentially, GameMaker enables you to save Sprites, Backgrounds, and Fonts to different groups for your reference later.
To create a Texture Group, follow these steps:From the main menu, choose Resources⇒Change Global Game Settings.
The Global Game Settings window opens.Click the Texture Groups tab, as shown in Figure 2-15.Click the Add button near the bottom of the window (refer to Figure 2-15).
A new Texture Group appears in the Texture Groups section.To rename the new Texture Group, select it, and then click the Rename button (near the Add button).
The Rename Texture Page dialog box appears (see Figure 2-16).
Figure 2-15: The Texture Groups tab of the Global Game Settings window.
Figure 2-16: The Rename Texture Page dialog box.
The renamed Texture Page appears in the Texture Groups section.Click OK to save and close the Global Game Settings window.
Now that you have more than one Texture Group, when you’re in the Sprites Properties, you can assign that Sprite to the new Texture Group. From the Texture Group drop-down list, select the group you want (see Figure 2-17). Texture Groups do help optimize game performance.
Figure 2-17:Choose the Texture Group you want from the drop-down list.
In this section, I provide a quick overview of Objects, which are what make up the different parts of the game, such as the player, the enemy, the score display, and so on. Objects can also control the game through the different Events and Actions that you add to them.
„Ich bin wirklich begeistert. Auch die Möglichkeit des zusätzlichen eReaders im Abo finde ich persönlich toll.”
„Die Auswahl von Legimi ist großartig.”
„Der Leser findet seine E-Books/Hörbücher sehr schnell und sie lassen sich, ob mit oder ohne Internetverbindung problemlos öffnen.”
Wurm sucht Buch
„Ich finde das Angebot von Legimi richtig toll.”
„Besonders schön finde ich die große Auswahl an möglichen Abo-Modellen und besonders die Abos mit eReader.”
Miss Foxy Reads
„Ich muss sagen, dass ich von dem E-Reader mehr als positiv überrascht bin.”
„Das ist wirklich eine großartige Idee und mal was ganz Anderes.”
Mikka liest das Leben...
Tausende von E-Books und Hörbücher
Ihre Zahl wächst ständig und Sie haben eine Fixpreisgarantie.
Sie haben über uns geschrieben:
Dabei gewährt der E-Book-Anbieter größtmögliche Freiheiten
Größter Vorteil die Möglichkeit, in der aktuellen App komfortabel zwischen E-Book und Hörbuchversion eines Titels
Spotify for E-Books