Game Development Reference
In-Depth Information
also work, it's best to avoid changing the anchor point whenever you can do so
by altering the node's position.
Now select the
springboard_spring
, and switch to the
Item Physics
tab. Check
Enable
physics
,
and uncheck
Affected by gravity
and
Allows rotation
.
Unchecking
Affected by gravity
prevents gravity from influencing the spring. You deselect
this check box because you may want to use the spring as an upside down or sideways
spring, and gravity would only serve to decrease the force of an upward spring while in-
creasing it for a downward-oriented spring. Disabling rotation will prevent the spring
from rotating to the sides, especially when it hits an object. It's difficult enough to keep
the spring aligned to the same outward-facing direction without resorting to programming.
And let's not forget to define the springboard's collision shape. Keep in mind that the
spring's collision shape should encompass the shape of its child sprite, the board. Still, 10
points for the shape are plenty. (See
Figure 9-18
.) Two points are spent to allow the sides
to give the player a slightly outward-oriented spin if the player misses the center of the
springboard.
Figure 9-18
.
The shroom-shaped spring includes the board's collision shape. The zoom level is 8x, hence the
blurred image
As seen in
Figure 9-18
,
you should try to make the bottom of the spring as rectangular as
possible. That's the “bolt” part that should fit into the shaft defined by the
spring-
board_metal
as closely as possible.
Speaking of which: select the
springboard_metal
, go to the
Item Physics
tab to
Enable
physics
. Then change the body's type to
Static
. You can begin editing the shaft's collision
shape right away.
Search WWH ::
Custom Search