Game Development Reference
In-Depth Information
1: {
2: if( check_standing_on( other.id, 1, 0 ) == true )
3: {
4: y -= speed;
5: move_on_top_of( -1, obj_solid );
6: }
7: else
8: {
9: x = xprevious;
10: y = yprevious;
11:
12: move_to_contact_with( direction, -1, obj_solid );
13:
14: hspeed = 0;
15: }
16: }
Figure 12-2. Flynn cannot move right from this position, as his bounding box (blue) keeps colliding with the
corner pixel of the platform object (green) and putting him back into his previous position (red)
9.
We'll make another small tweak that affects the walking mechanic when switching to
the ice state and back again. It is easy for the larger Flynn character to end up standing
on both ice and land at the same time, you can get “fighting” (rapidly switching back
and forth) between the two states on the borders between ice and land. Open
obj_flynn_ice and select the Collision event with obj_solid . Edit the Execute Code
action to include an extra line above the last two:
if( check_standing_on( obj_slope, 1, 0, 0 ) != true )
if( check_standing_on( obj_platform, 1, 0, 0 ) == true )
instance_change( obj_flynn_land, true );
 
Search WWH ::




Custom Search