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

Customizable controls

The final system we will be incorporating into our game is one through which players can customize and save their keybinds so that they are different from the left and right arrow keys and the Enter key. We will only put in a binding system for these keys, but it is quite easy to extend the system to include other keys, such as the one for pause, and moving the selection up and down on a menu. The keybinds will be saved to our .ini file whenever the game is closed, and loaded back in at its very start.

So let's begin putting it in! First, make another button sprite, just like the others that we made, but it will be for modifying the keybindings. When you've finished that, open up the pause menu object. The majority of our code for the keybindings system will be programmed in here, as creating another object could make things complicated.

First, we'll be setting a variable in the Create event of our pause menu object. Set binding to false. This is to tell...

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