Game Development Reference
In-Depth Information
18. Right-click on the Collision event with obj_solid and Duplicate Event to create an
identical Collision event with obj_lift_hlimit .
19. Add a Destroy event and include a Set Variable action ( control tab) that sets x to
xprevious . This was done in the Collision event for the up and down lifts, but all of the
lift sections need to move backā€”not just the one that collided. Therefore, this action
has been moved to the Destroy event that is then called by each lift segment as part of
changing instance.
20. Repeat steps 4-19 for obj_lift_right or copy all the actions from each event in
obj_lift_left . This time, set the Hor. Speed in the Alarm 0 event to LIFT_SPEED and
use
16 for both of the horizontal_offset Set Variable actions. You'll also need to use
obj_lift_right for Argument0 of the check_object_returned script and obj_lift_left
for Argument1 of the change_instance_for script. Don't forget to Change into the
obj_lift_left object in the last Change Instance action as well.
Now add a few horizontal lifts around the level and make sure that they work too. Bear in
mind that there is nothing stopping moving enemies from walking onto moving platforms, so it's
best to use some enemy limiters around the end points if that might be a possibility.
-
Relativity
Zool can already walk on top of the lift objects because they use obj_ledge as their Parent .
However, he generally falls off as soon as they move because he is not physically carried along
with them as if he was standing on their surface. To achieve this, we need to make Zool's
movement relative to the movement of any lift he is standing on. Actually changing Zool's
horizontal and vertical speed can be problematic, so it is easier to modify Zool's position directly
by the movement speed of the lift in each step.
Making Lifts Lift
1.
Reopen obj_zool_land and select the Begin Step event.
heck_object_returned
with Argument0 set to obj_lift , Argument1 set to 0 , Argument2 set to 1 , and
Argument3 set to true . Therefore, this action checks for instances of obj_lift 1 pixel
below Zool and puts the result into the returned variable.
c
2.
Include an Execute Script a ction ( control tab) for the Script
3.
Include a Test Variable action that tests if returned is larger than 0 .
4.
Include a Start Block action.
Include a Set Variable action that sets x Relative to returned.hspeed . In other words,
this is adding the platform's horizontal speed to Zool's position.
5.
6.
Include a Set Variable action that sets y Relative to returned.vspeed . In other words,
this is adding the platform's vertical speed to Zool's position.
Include an End Block action. The Begin Step event of obj_zool_land should now
contain eight actions, as shown in Figure 6-6.
7.
 
Search WWH ::




Custom Search