The customMovement behavior doesn't really add much to be helpful for that. maybe the "stepping mode" where you can check for collisions in the in between positions with the "on step" trigger.
Pushing out once colliding isn't the best here. It would be better check if the way is clear before moving.
And actually I would go for doing the whole thing with events.
I'd put everything I wanted to collide with in a family and call that solid then the simplest example would be this:
[negated] sprite: overlaps solid at offset (1,0)
sprite: set x to self.x+1
You could then extend it with a speed instance variable to make the acceleration and finer motion:
[negated] sprite: overlaps solid at offset (self.speed*dt,0)
sprite: set x to self.x+self.speed*dt
sprite: add 1500*dt to speed
else
sprite: set speed to 0
When hitting a solid it will look to stop short sometimes and close the gap. This can be improved by using a loop to check each step in between. for that add another instance variable called "delta". Another benefit is this keeps the objects on pixel coordinates while staying framerate independent. This adds consistency to the collisions so they always stop the same distance away.
every tick
sprite: add 1500*dt to speed
sprite: add self.speed*dt to delta
repeat sprite.delta times
---[negated] sprite: overlaps solid at offset (1,0)
--- > sprite: set x to self.x+1
--- > sprite: subtract 1 from delta
---else
--- > stop loop
--- > sprite: set delta to 0
--- > sprite: set speed to 0
Now you could instead use the custom movement behavior instead by setting the stepping mode property and using the on step trigger. The only issue is "on step" is triggered after the object moves so you'll have to back it up or push out. That can go wrong if it pushes out into another object, which can easily happen with objects with floating point coordinates while being close to each other.
EDIT:
Here's an example:
https://dl.dropboxusercontent.com/u/542 ... _move.capx
The events are generic for any angle and I shrank the collision polygon a bit.
One more thing that could be done with this is simultaneous movement of the blocks. Right now their motion is handled on by one, but you also could let each move a pixel, then repeat for all of their deltas are below 1.
https://dl.dropboxusercontent.com/u/542 ... neous.capx
Further tweaks would probably be some rounding in some spots to keep things with integer values, but I'm not sure if it's needed.
EDIT2:
had a typo in limiting the speed. used max when it should have been min.