Easy Bullet Time (Game Maker)

Introduction

Programming bullet time (like in The Matrix) into your game is easier than you may think, in fact, Game Maker comes equipped with a variable that makes it easy to create bullet time. This tutorial will show you how to achieve simple bullet time in your game. It deals only with slowing down the time in your game. Special effects during bullet time will be dealt with in another tutorial.

This tutorial is for Game Maker 6.x.

What is Bullet Time?

To create a bullet time effect, we first have to know exactly what bullet time is. Bullet time is nothing more than slowing down time. This means slowing down the speed of your game. It would be easy to do if only Game Maker had a way to change the speed of your game.

Luckily, it does. All you need to do is change the variable room_speed.

room_speed

room_speed is a variable to contains the current speed of your game. Most games run using a room_speed of 60. 30 is the default room_speed, but we recommend using 60.

To slow down the game, and thus, create a bullet time effect, simply reduce the room_speed. If the room_speed is 60, you can slow down the game by setting it to 30, which is half of 60 using this code :

````room_speed = 30;`
```

To speed the game back up to normal time, simply set room_speed back to 60.

````room_speed = 60;`
```

A switch

If you want, to make your code more readable, you can include a switch made up of a global variable and an if construction. The global variable is global.bullet_time and should be set to normal speed in the very first room of your game.

````global.bullet_time = false;`
```

Reading this code, you can easily see that you are turning off bullet time. To make the switch, use this if construction :

``````if(global.bullet_time)
{
room_speed = 30;
}
else
{
room_speed = 60;
}```
```

With this code, you can turn on and off bullet time like a switch with global.bullet_time :

``````global.bullet_time = false; // bullet time off
global.bullet_time = true; // bullet time on```
```

Conclusion

Congratulations, you have learned all you need to know to slow down time for a bullet time effect. This method will work will all kinds of games in which you need to slow down time, including fighting games.

Related Pages

page revision: 10, last edited: 30 Jun 2012 15:50