#define hit_wall2 // Simple platform movement code // Oliver Broad 2004 // This code goes in the End_Step event // // First test if a collision occured // Note this version should be more reliable in games where // collision events can modify speed and direction // however it may lead to slightly inconsistant collision handling // x=xprevious y=yprevious if place_free(x+hspeed,y+vspeed) { x+=hspeed y+=vspeed } else { //Move horizontally, testing for contact if hspeed<>0 { move_contact_solid(180*(hspeed<0),abs(hspeed)) if not place_free(x+sign(hspeed),y) { hspeed=0 } } //Move vertically, testing for contact if vspeed<>0 { move_contact_solid(90+180*(vspeed>0),abs(vspeed)) if not place_free(x,y+sign(vspeed)) { vspeed=0 } } }