Login | Register

Slow motion

June 2, 2007, 23:30 by Calle
[loading]
-->
I recieved a very intresting question today, it is as follows: "I was wondering if there is a way to make the game go in slow motion." - and of course there is a solution to this. What we want is to make everything go proportionally slow, for an example, it won't do to decrease the speed with 5 for every object, no. We must decrease the movement of things proportionally, such that speed becomes speed/5. But if you actually try to do this in a game you will encounter a lot of troubles; because sometimes a movement can be defined simply as x+=4, or y-=5, and then you'll need to change the 5 and the 4 and this is a lot of work. Even though it can be done, it is absolutely not effective. Not to talk about the scripts you would have to write to determine all the moving objects etc... no, you must find a general solution to the problem, and luckily there is one. And that is also why the question is intresting...

Solution: Open up a room and go to the settings tab.. You there see something called "room speed", default set to 30. This indicates how many steps is taken each second. There is a variable the corresponds to this value, called room_speed. It can be altered during game play. If you take less steps per second then everything will automatically be slower; for an example a bullet moving with speed five when room_speed equals 30 will move 150 pixels per second, but if you decrease room speed to 15 it will only move 15*5=75 pixels a second, half the number. This is what can create a slow motion effect.

room_speed /= 3; //Slow-motion
room_speed *= 3; //Restore


Play around a little with the values, and hopefully you will find what you are looking for.

Comments

Loading comments... [loading]
.
Users logged in:

game maker articles, game maker examples, game maker tutorials, gmtutorials, game maker questions and answers, game maker crash course, how to create games