Problem description: I'm at a complete loss with this, especially working out which objects to move. The idea is that blocks move down into empty spaces. Also, when a column is empty, all the blocks to the right of said column shift left to fill it up (leaving the empty columns on the right).
I'd prefer to move them pixel by pixel to give a better "falling and sliding" effect.
Some images to help illustrate what I'm trying to do:
Which then becomes this:
Jun 30 2013, 11:09 am
|
|
I currently have my blocks falling by calling this proc every time blocks are removed from play.
|
Do you want them to fall in both directions at the same time? Or move left and then down?
|
I want them to fall down first, and only move left to occupy the empty columns. What I've tried so far keeps moving the blocks left until they hit another block.
The images should give a good idea of what I'm trying to do. |
Why not make it so that when an object is deleted it checks if there are any other objects in that column, and then moves everything that is to the right 1 square to the left and then down?
obj/Block This is just off the top of my head, but the basic concept is there even if this code doesn't function properly. After that you can cause them to move south. |
That's not at all what I'm looking for. I think my 'falling' movement is interfering with my attempts to accomplish this so far.
obj/Block I was using Bump() to stop my blocks from walking when they hit another, however that caused problems with them hitting the block below before it had the chance to fall. My latest method of moving the columns of blocks to the left once one column is empty leaves a few stragglers behind. proc/CheckCols() |
Oh nevermind.
I see the problem, you should just loop to check to see if there is null at any point along the y = 1 level, and move everything above that x to the left one. I think that's what you want to accomplish anyway. |
That's precisely what I am doing, however it's just not working properly.
proc/CheckCols() |
Alright, I've made much more progress. I have my columns moving over just fine now, and I'm left only with one issue. I need a better way of having my blocks 'fall'. I then need to call CheckCols() only once all the blocks have fallen down.
proc/Slide() |
Try a loop?
As you create new blocks, add them to a list- have the loop constantly running and moving an blocks with in that before mentioned list to move down- upon landing remove them from the list. |
I think I see what you're saying, but this is working out to be very 'laggy'. Perhaps I'm doing something wrong?
var/list/fall = list() |
That sleep should be one indent to the left, otherwise you're pausing for every block?
|
Ah yeah, that helps a lot. Now for some reason, the list 'fall' is never completely emptied, so it is constantly running and stacking up.
|
Ok, I've just about got this sorted. The only issue now is that my bottom row of blocks are not acutally Bump()'ing into anything but the map edge, so they are not removed from my list.
Is there any way to detect a Bump against the map edge or should I add an invisible layer of blocks to the bottom? |