Dhryn
April 24th, 2006, 03:46 PM
I found the following code in a tutorial:
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;
}
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?