05-05-2011, 07:30 AM
Hmm... Since you're making this in Game Maker, I'll actually be able to help you.
Here's my idea. Have two types of blocks. Normal blocks that just sit there, and the blocks that's just been placed. These blocks check (in their Step Event) whether there's a free place below them; if so they move one snapping value down (assuming it's only possible to place blocks at snaps). Whenever there's a block below it, it changes into a normal block.
Now, it doesn't end here, because we want blocks to fall down when the foundation below them are taken away. We could do this with a recursive script...
//start_to_fall()
me = place_meeting(x,y - 16,obj_block_normal)
with(me){
instance_change(obj_block_falling,false)
start_to_fall()
}
Put simply, it finds the first block above the calling position (let the normal blocks call this script in their destroy event), tells it to fall downwards, then THAT block finds the block right above it, tells it to fall downwards... and so on.
Here's my idea. Have two types of blocks. Normal blocks that just sit there, and the blocks that's just been placed. These blocks check (in their Step Event) whether there's a free place below them; if so they move one snapping value down (assuming it's only possible to place blocks at snaps). Whenever there's a block below it, it changes into a normal block.
Now, it doesn't end here, because we want blocks to fall down when the foundation below them are taken away. We could do this with a recursive script...
//start_to_fall()
me = place_meeting(x,y - 16,obj_block_normal)
with(me){
instance_change(obj_block_falling,false)
start_to_fall()
}
Put simply, it finds the first block above the calling position (let the normal blocks call this script in their destroy event), tells it to fall downwards, then THAT block finds the block right above it, tells it to fall downwards... and so on.