Hello Flashkit, the code work, but dont perfectly, when the player hillside on the diagonals of a other object, he is pushed in a weird way, is a bug. The code is this:
PHP Code:
while (_root.object.hitTest(this._x - this._width / 2, this._y, true))
{
this._x += 5;
}
while (_root.object.hitTest(this._x + this._width / 2, this._y, true))
{
this._x -= 5;
}
while (_root.object.hitTest(this._x, this._y - this._height / 2, true))
{
this._y += 5;
}
while (_root.object.hitTest(this._x, this._y + this._height / 2, true))
{
this._y -= 5;
}