Game Development Reference
In-Depth Information
Within zooldrag.gmk
1. Open up the End Step event of obj_zool_land and look at the code in the Execute Code
action. Toward the end of the code, we have the following lines:
1: if( place_meeting( x, y+1, obj_platform ) != true )
2: {
3: if(place_meeting(x, y+max(speed,LIFT_SPEED+1), obj_platform) == true )
4: move_to_contact_with( 270, -1, obj_platform );
5: else
6: instance_change( obj_zool_air, true );
7: }
8:
9: if( place_meeting( x+facing, y, obj_wall ) == true )
10: instance_change( obj_zool_wall, true );
11:
12: if( place_meeting( x, y+1, obj_slope ) == true )
13: instance_change( obj_zool_ice, true );
The first two calls to place_meeting on lines 1 and 3 are the ones that mainly need
addressing here. It's not worth changing the call on line 9, as it is making a horizontal
check for walls, which can't be affected by ledges.
Within zoolgml.gmk
1. Now open up the new End Step event of obj_zool_land and look at the alternative
code in the Execute Code action for the three place_meeting tests:
1: if( check_standing_on( obj_platform, 1, 0 ) != true )
2: {
3: if(check_standing_on(obj_platform, max(speed,LIFT_SPEED+1),0) == true )
4: move_to_contact_with( 270, -1, obj_platform );
5: else
6: instance_change( obj_zool_air, true );
7: }
8:
9: if( place_meeting( x+facing, y, obj_wall ) == true )
10: instance_change( obj_zool_wall, true );
11:
12: if( check_standing_on( obj_slope, 1, 0 ) == true )
13: instance_change( obj_zool_ice, true );
Here, we've used a brand new script function called check_standing_on to check for
specific kinds of objects directly below the instance. We'll cover the operation of that
function in the scripts section coming up next. The place_meeting function was used
in a number of objects to look for platforms beneath Zool's feet, so all of these tests
have been substituted with check_standing_on in the zoolgml.gmk version.
 
Search WWH ::




Custom Search