//basic physics
if place_free(x,y+1) and place_free(x,y+vspeed) {gravity = 0.60 gravity_direction = 270}
if (hspeed >= 5) then hspeed = 5
if (hspeed <= -5) then hspeed = -5
if (vspeed >= 10) then vspeed = 10
if (vspeed <= -10) then vspeed = -10
if hspeed!=0 and (!place_free(x,y+1)) then {friction=0.4}
if vspeed > 0 and (collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+1,obj_solid,1,1)) {move_contact_solid(270, 16) move_outside_solid(90,16) gravity = 0 vspeed = 0}
if vspeed < 0 and (collision_rectangle(bbox_left,bbox_top-1,bbox_right,bbox_top,obj_solid,1,1)) {move_contact_solid(90, 8) move_outside_solid(270,8) vspeed = 0}
if hspeed > 0 and (collision_rectangle(bbox_right,bbox_top,bbox_right+1+hspeed,bbox_bottom,obj_solid,1,1)) {move_contact_solid(0, 8) move_outside_solid(180,8) hspeed = 0}
if hspeed < 0 and (collision_rectangle(bbox_left-1+hspeed,bbox_top,bbox_left,bbox_bottom,obj_solid,1,1)) {move_contact_solid(180, 8) move_outside_solid(0,8) hspeed = 0}
Edited by hydroxy, 21 September 2010 - 07:36 PM.











