For the box to be able to fall:
obj_box STEP-event:
if place_free(x,y+1) //if there's no ground underneath the box:
{
gravity_direction=270
gravity=0.5 //set the gravity to make it fall.
}
else //The code in brackets below this will be executed if there is indeed ground below the box:
{
gravity=0 //Disable gravity.
vspeed=0 //Set the vertical speed to 0.
}
Check if box is falling fast enough to be able to smash:
obj_box COLLISION WITH WHATEVER OBJECT YOU WANT IT TO BE ABLE TO SMASH-event:
if vspeed>//Put a number here, fiddle around with it a little bit. It decides whether the current vertical speed of the box is high enough to be smashed or not.
{
//Put smash code here. If you created another object that handles this, put instance_change(x,y,obj_boxsmash) here instead of this green line.
}
If you want to save time, you could create a parent for all the objects that have a chance to smash the box.
To do this you create a new object obj_boxparent. Then go to the objects that have a possibility to smash the
box. Then at the bottom left of the object editor, click Set Parent and select obj_boxparent from the dropdown menu.
Then instead of setting the collision to many objects, set the collision-event for above code to this obj_boxparent.
The box smash thing will happen perfectly for the right objects.
Edited by HerpDerp, 11 July 2012 - 10:04 PM.