Game Development Reference
In-Depth Information
Note For all visual effects, there is a simple rule—don't overdo it. Too much smoke will only annoy the
player! You may even want to create the effect only once every few steps using timelines or alarms.
Smooth Motion
Ever wondered why your game's movement doesn't always look as smooth as in the commercial
games you've played? There are two reasons for this:
The default room speed is set at 30, which means Game Maker only redraws the
screen 30 times per second. Most CRT screens “refresh” the screen at twice that rate.
The updates by Game Maker and those by the screen are not synchronized. While the
screen is half-way displaying the old image, Game Maker switches to the next. The
result is a mixed image between two steps, an effect commonly known as “tearing.”
As you might guess, it's not difficult to get your game to look much smoother, but there is a
golden rule to save you a lot of work: apply these changes before you create anything else in your
game . This is important because we'll increase the room speed, and this influences the speed of
almost everything else: sprite animations, path following, instance movements, alarm time,
particles, background scrolling, and so forth. You don't want to go back to adjust everything!
Start with: Reference/Framework/bouncing1.gmk
Creating Smooth Motion
1.
Double-click the Global Game Settings in the resource tree and go to the resolution
tab. Enable Use synchronization to avoid tearing .
2.
For all rooms in the game, open the room editor, go to the settings tab, and set the
room speed to 60 .
3.
If necessary, adjust all game speeds. In the case of our example, the original room
speed was 30 and has now been doubled, which means that the speed of all movement
needs to be halved. Fortunately, for this game there is only one place where we need to
do this. Open obj_cog , select the Create event, and double-click the Set direction and
speed of motion (M ove Free )action. Set the speed to 2.5 + random(4) .
Result: Reference/Result/smooth_motion.gmk
Note Not all screens refresh at a speed of 60 updates per second, but it is the best common value for
most computer users. Monitors don't go below 60 and anyone playing at a higher refresh rate will still get
good results.
 
Search WWH ::




Custom Search