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

Adding the finishing details to the game


The game is now functionally complete, but it doesn't have any polish or the finishing details we would expect of a full game. There is no music, no background art, and no explosions! Let's fix that right now.

Adding the game music

We want the music to start at the beginning and play for the duration of the game. When the win/lose condition occurs, we want the music to fade out to let the player know that the game is over.

  1. Create a new Sound and name it snd_Music.

  2. Load Chapter 3/Sounds/Music.mp3. Kind should be set to Background Music.

  3. Reopen scr_Overlord_Create. Since the Overlord controls the overall game, we will use it to control the music as well. After the last line of code, add the following:

    sound_play(snd_Music);
    sound_loop(snd_Music);
    volume = 1;
    sound_global_volume(volume);

    We start by playing the music and set it to loop. We then create a variable, volume, that we will use for controlling the sound level and the fade out. We have set the sound...