Book Image

GameMaker Cookbook

Book Image

GameMaker Cookbook

Overview of this book

GameMaker: Studio started off as a tool capable of creating simple games using a drag-and-drop interface. Since then, it has grown to become a powerful instrument to make release-ready games for PC, Mac, mobile devices, and even current-gen consoles. GameMaker is designed to allow its users to develop games without having to learn any of the complex programming languages such as C++ or Java. It also allows redistribution across multiple platforms. This book teaches you to harness GameMaker: Studio’s full potential and take your game development to new heights. It begins by covering the basics and lays a solid foundation for advanced GameMaker concepts. Moving on, it covers topics such as controls, physics, and advanced movement, employing a strategic approach to the learning curve. The book concludes by providing insights into complex concepts such as the GUI, menus, save system, lighting, particles, and VFX. By the end of the book, you will be able to design games using GameMaker: Studio and implement the same techniques in other games you intend to design.
Table of Contents (17 chapters)
GameMaker Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Replicating the Doppler effect with emitters


If you've ever stood by the side of a road as cars pass by, you've experienced the Doppler effect. Without getting into too much detail, the Doppler effect is the change in frequency of a wave (in this case, a sound wave) for an observer moving relative to its source. In the case of a car moving by a stationary observer (that is, you), the sound waves caused by the car's engine are being emitted closer together as the car approaches than they are as the car recedes. That's why a car emits a higher pitch noise the closer it gets and a lower pitch noise as it passes by and drives away. With the help of GameMaker's 3D audio functions, we can actually recreate this effect.

Getting ready

Once again, we'll be using the player object that we created in the Adding sound emitters and listeners recipe. Make sure that the Create event for obj_player contains the following code:

audio_listener_orientation(0, 1, 0, 0, 0, 1);

Make sure that the Step event does...