Book Image

HTML5 Game Development with GameMaker

By : Jason Lee Elliott
Book Image

HTML5 Game Development with GameMaker

By: Jason Lee Elliott

Overview of this book

The introduction of HTML5 has revolutionized the web browser as a legitimate gaming platform with unlimited potential. Making games for the browser has never been simpler, especially with GameMaker Studio. Developers have full control over asset management, built-in systems for physics, particles and path finding. In addition, it offers a rich scripting language and extensions for developers now enabling everyone to create games and monetize them quickly and easily.HTML5 Game Development with GameMaker will show you how to make and release browser based games using practical examples. This book utilizes GameMaker's powerful scripting language allowing you to create your first game in no time. With this guide you will develop a thorough skill set and a coherent understanding of the tools to develop games of increasing complexity, gradually enhancing your coding abilities and taking them to a whole new level. The GameMaker Studio environment allows you to jump right into building browser based games quickly and releasing them online. The chapters focus on core practical elements, such as, artificial intelligence and creating challenging boss battles. This book guides you on how to use advanced features easily and effectively, these include, data structures and demonstrating how to create rigid body physics with simple explanations and visual examples. By the end of this book you will have an in-depth knowledge of developing and publishing online social browser based games with GameMaker.
Table of Contents (16 chapters)
HTML5 Game Development with GameMaker
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

The introduction of HTML5 has revolutionized the web browser as a legitimate gaming platform with unlimited potential. Making games for the browsers has never been simpler, especially with GameMaker Studio.

HTML5 Game Development with GameMaker will show you how to make and release browser-based games using practical examples. This book utilizes GameMaker's powerful scripting language allowing you to create your first game in no time. With this guide you will develop a thorough skill set and a coherent understanding of the tools to develop games of increasing complexity, gradually enhancing your coding abilities and taking them to a whole new level.

This book guides you on how to use advanced features easily and effectively, including, data structures and demonstrating how to create rigid body physics with simple explanations and visual examples. By the end of this book, you will have an in-depth knowledge of developing and publishing online social browser-based games with GameMaker.

What this book covers

Chapter 1, Getting to Know the Studio with Your First Game, will help you in making your own game. You will have an opportunity to explore the GameMaker: Studio interface. In this chapter, we will be creating and implementing every type of resource available while utilizing all the various resource editors.

Chapter 2, Triple 'A' Games: Art and Audio, will help you understand how art and audio work in GameMaker: Studio. It will cover the acceptable image formats and how to import a sprite sheet. In this chapter, we will be creating a tile set that will make better use of computer memory and allow for large unique worlds, and understand how to control sounds and the direction they are heard from.

Chapter 3, Shoot 'em Up: Creating a Side-scrolling Shooter, will help you in creating your first side-scrolling shooter. In this chapter, we will be applying all three methods of movement: manually adjusting the X and Y coordinates, and setting the speed and direction. We will be able to add and remove instances from the game world dynamically.

Chapter 4, The Adventure Begins, simplifies the player controls by placing the keyboard checks and collision forecasting into a single script. It covers several ways to deal with Sprite animation from rotating the image to setting what sprites should be displayed. We will be dealing with artificial intelligence through the use of proximity detection and path finding.

Chapter 5, Platform Fun, delves into systems design and creating some very useful scripts. We will be building an animation system that most objects in the game utilize and forecast for collision, and apply our own custom gravity to the player. Lastly, we will be creating a three-phase Boss fight utilizing all our previous knowledge along with our new systems.

Chapter 6, Toppling Towers, covers the basics of using the Box2D physics system. We will be learning how to assign Fixtures to objects and different properties that can be modified. We will be creating a Chain and Wrecking Ball that utilizes Revolute Joints, so that each piece would rotate with the one preceding it. Also, the chapter covers Draw GUI events and the difference between a Sprite's location as represented in a Room versus the location on the screen.

Chapter 7, Dynamic Front Ends, consists of adding an entire frontend, including a Shop and unlockable levels. We will be dealing with Grids, Maps, and List data structures to hold a variety of information. We will be rebuilding the HUD, so that we could display more buttons, display only the available equipment, and build a basic countdown timer. Lastly, we will add a save system that teaches us about using local storage and allows us to have multiple player saves.

Chapter 8, Playing with Particles, will show you how to add some spit and polish to really make our game shine. We will be delving into the world of particles and create a variety of effects that will add impact to the TNT and Pillar destruction. The game is now complete and ready to be released.

Chapter 9, Get Your Game Out There, will help us in uploading a game to a web server using an FTP client. We will be integrating Facebook into the game, allowing players to log in to their account, and post level scores to their walls. It also covers analytics using Flurry to track how players are playing the game. Finally, we will briefly learn about making money off our games through sponsorship.

Appendix, Drag-and-drop Icons to GameMaker Language Reference, will help us in understanding what each icon does, as each icon is often more than a single function. The appendix provides a thorough reference of the code equivalent to all the drag-and-drop icons.

You can download this Appendix from http://www.packtpub.com/sites/default/files/downloads/4100OT_Appendix_Drag_and_drop_Icons_to_GameMaker_Language_Reference.pdf.

What you need for this book

This book requires GameMaker: Studio Professional with HTML5 export module, and an HTML5-compliant browser (Google Chrome works the best).

Who this book is for

This book is for anyone with a passion to create fun and action packed web browser games using GameMaker: Studio. This intuitive practical guide appeals to both beginners and advanced users wanting to create and release online games to share with the world, using the powerful GameMaker tool.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Create a new Sound and name it snd_Collect."

A block of code is set as follows:

mySpeed = 4;
myDirection = 0;
isAttacking = false;
isWalking = false;
health = 100;
image_speed = 0.5;

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

isWalking = false;
if (keyboard_check(vk_right) && place_free(x + mySpeed, y))
{
    x += mySpeed;
    myDirection = 0;
    sprite_index = spr_Player_WalkRight;
    isWalking = true;

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.