obj1 is a block in the air.
obj2 is the ground.
speed is obvious anyway.
Code:
var speed:Number=0;
stage.addEventListener("enterFrame", fall);
function fall (Event) {
speed++;
if (obj1.hitTestObject(obj2)) {
speed=0;
}
obj1.y+=speed;
}
Problem:
obj1 does stop when hitting the ground, however it "sinks" into the ground (obj2) more or less depending on height and it seems pretty random on the first look although it sinks always by the same amount if the height is the same. (It doesnt necessarily sink more if it drops from a higher point.)
Whole .fla file just in case: http://spamtheweb.com/ul/upload/070409/2 9477_Experimental.fla
How the .swf looks (reload page to restart, sorry): http://spamtheweb.com/ul/upload/070409/2 9529_Experimental.php
Thanks for any help.