Game Development Reference
In-Depth Information
lower horizontal collision segment should be almost parallel to the horizontal axis. (See
Figure 9-22
.
)
Figure 9-22
.
The springstopper's collision shape
The springstopper is supposed to suddenly prevent the spring from expanding any further.
It ought to keep the spring in its shaft so that it can't move to the side, and it gives the im-
pression of a spring that is actually extending upward due to actual spring force rather
than being pulled from the outside.
Before you can test this, you have to select the
springboard_spring
. On the
Item Physics
tab, enter
spring
in the
Categories
field and enter
springstopper, player, obstacle
in the
Masks
field. This will make the spring the only body that will collide with the springstop-
per.
To ensure collisions with the player continue to work, you also have to open
Player.ccb
and then add
spring
to the player sprite's
Masks
field so that it contains the following la-
bels:
trigger, border, obstacle, spring
.
And if you want the spring to collide with the chains and ropes, you'll have to edit
Chain.ccb
and
Rope.ccb
in order to add
spring
to each physics body's
Masks
field.
Search WWH ::
Custom Search