Game Development Reference
In-Depth Information
Line 5 makes sure the text wraps once it has completely disappeared from the
screen. We do this by checking if y is smaller than the negative value of the height (in
pixels) of the credits string—this is equal to checking if the text is positioned entirely
above the room. Note that the function string_height returns the total height
regardless of the number of lines used in the string when using the hash character. If
the text is out of the screen, the value of y is reset to room_height to make it start at the
bottom again. Line 6 finally draws the text at ( 320 , y ). A value of 320 is the middle of our
room and the text lines are centered around this.
5.
Open room_test and place an instance of obj_endcredits anywhere in the room.
Result: Reference/Result/scrolling_text_vertical.gmk
Tip Put your end credits in a special room and always give the player the possibility to go back to the
title screen.
Smoke Trail
If it flies or drives, it burns fuel. And whether it's rockets, aircrafts, or cars, it just has to smoke!
After all, it's only a game, so we can temporarily forget about clean emission and the Kyoto
Protocol. Game Maker Pro users can use particle effects to create smoke trails. The challenge is in
making sure that these trails appear at the right place at the right time. We'll use our spaceship
example and make it blow smoke every time the engines are burning. It just takes a single step
using one of Game Maker's built-in default particle effects.
Start with: Reference/Framework/spaceship2.gmk
Creating a Smoke Trail
1.
In our example, the engines are burning as long as the Up arrow key is being pressed.
Open the object obj_spaceship and select the Keyboard , Up event. At the end of the
action list, include a Create Effect action. Note that although this action draws effects on
the screen, you don't need to use it in the Draw event. Rather, you use it to start the effect
and Game Maker takes care of drawing it.
In the action, select smoke as the Type . For X , use lengthdir_x(-36,image_angle) ,
for Y use lengthdir_y(-36,image_angle) . We use image_angle rather than direction
because we always need to create smoke relative to where the spaceship is facing. Note
that we use negative values as the first parameter because we want to put the smoke
behind the ship rather than in front of it. Set Size to small and set the Color to white or
gray. Set Where to above objects and check the Relative box.
Result: Reference/Result/smoke_trail.gmk
 
 
Search WWH ::




Custom Search