Game Development Reference
In-Depth Information
In the Bug Catcher game, I used the Tint color effect to make the platform on the bottom-left corner
of the stage a darker shade of green than the other platforms. To tint an object, select it, choose Tint
from the Style drop-down menu, and play with the options until you find a color that you're happy
with. Figure 9-11 shows the settings used to tint the bottom-left platform.
Figure 9-11. Tinting allows you to give instances a unique color without changing the color of
the parent symbol.
Now that the platforms have been plotted on the screen, you can put them to work.
Detecting platform collisions
In the Project panel, you'll find the ?khheoekj class. This is the same class used in previous chapters,
but in this chapter you'll use one of its methods: lh]uan=j`Lh]pbkni. Like the ^hk_g method, it pre-
vents two rectangular objects from intersecting. However, it's been upgraded with some fancy new
features that allow it to handle physics. When two rectangular objects collide, you can specify whether
the first object bounces back when it hits. You can also specify whether it loses some additional
momentum when it does so, by adding some extra friction into the mix.
The ?khheoekj*lh]uan=j`Lh]pbkni method requires four arguments:
The first object, which is the lh]uan object
The second object, which is the lh]pbkni
The amount you want the lh]uan to bounce when it hits the platform
The amount of friction, which is lost momentum when the lh]uan object hits
Search Nedrilad ::

Custom Search