if (_root.stage1.hitTest(getBounds(_root).xMax, _y, true)) {
_root.stage1._x += mySpeed;
}
if (_root.stage1.hitTest(getBounds(_root).xMin, _y, true)) {
_root.stage1._x -= mySpeed;
}
if (_root.stage1.hitTest(_x, getBounds(_root).yMax, true)) {
_root.stage1._y += mySpeed;
}
if (_root.stage1.hitTest(_x, getBounds(_root).yMin, true)) {
_root.stage1._y -= mySpeed;
}
and modified it to work for my file, but it didnt come with an explination for how it works, I am main confused by the getBounds part, can some please explain this code to me?
if (_root.stage1.hitTest(getBounds(_root).xMax, _y, true)) {
_root.stage1._x += mySpeed;
}
if (_root.stage1.hitTest(getBounds(_root).xMin, _y, true)) {
_root.stage1._x -= mySpeed;
}
if (_root.stage1.hitTest(_x, getBounds(_root).yMax, true)) {
_root.stage1._y += mySpeed;
}
if (_root.stage1.hitTest(_x, getBounds(_root).yMin, true)) {
_root.stage1._y -= mySpeed;
}
if (_root.stage1.hitTest(getBounds(_root).xMax, _y, true)) {
_root.stage1._x += mySpeed;
}
This is for xmax = the highest point of _x in your movieclip like right side
xmin is the lowest xpoint to the left.
the same is for ymax and ymin.
hope that clears something up :S
um yeah that means the right side of the object. Actually i dont know so much about getBounds I think they are quite weird aswell. But if you know what each line does im sure you can use it =)