Guest_imported
New member
- Jan 1, 1970
- 0
Hi everyone................
On the stage there are two MC`s.
One is called user
The other one is called block
If user intersect with the block, it should stop!
The script is in a third MC off stage!
I think there is a syntax problem in the hittest line!
--------------------------------------------------------------------------------
onClipEvent (load) {
while (d<3) {
d = d+1;
duplicateMovieClip ("_root.block", "block_new" + d, d);
with ("block_new" + d) {
setProperty ("_root.block_new1", _x, 400);
setProperty ("_root.block_new1", _y, 100);
setProperty ("_root.block_new2", _x, 500);
setProperty ("_root.block_new2", _y, 250);
setProperty ("_root.block_new3", _x, 200);
setProperty ("_root.block_new3", _y, 250);
}
}
}
---------------------------Duplicating block and contolling User works fine
onClipEvent (load) {
while (d<3) {
d = d+1;
duplicateMovieClip ("_root.block", "block_new" + d, d);
with ("block_new" + d) {
setProperty ("_root.block_new1", _x, 400);
setProperty ("_root.block_new1", _y, 100);
setProperty ("_root.block_new2", _x, 500);
setProperty ("_root.block_new2", _y, 250);
setProperty ("_root.block_new3", _x, 200);
setProperty ("_root.block_new3", _y, 250);
}
}
}
onClipEvent (enterFrame) {
if (key.isDown(Key.DOWN)) {
if (_root.block_new + d.hitTest(_root.user._x, (_root.user._y+50), true) ne "true" {
setProperty ("_root.user", _y, (getProperty(_root.user, _y))+50);
}
}
if (key.isDown(Key.UP)) {
if (_root.block_new + d.hitTest(_root.user._x, (_root.user._y-50), true) ne "true" {
setProperty ("_root.user", _y, (getProperty(_root.user, _y))-50);
}
}
if (key.isDown(Key.LEFT)) {
if (_root.block_new + d.hitTest((_root.user._x-50), _root.user._y, true) ne "true" {
setProperty ("_root.user", _x, (getProperty(_root.user, _x))-50);
}
}
if (key.isDown(Key.RIGHT)) {
if (_root.block_new + d.hitTest((_root.user._x+50), _root.user._y, true) ne "true" {
setProperty ("_root.user", _x, (getProperty(_root.user, _x))+50);
}
}
}
thanks
Marc
On the stage there are two MC`s.
One is called user
The other one is called block
If user intersect with the block, it should stop!
The script is in a third MC off stage!
I think there is a syntax problem in the hittest line!
--------------------------------------------------------------------------------
onClipEvent (load) {
while (d<3) {
d = d+1;
duplicateMovieClip ("_root.block", "block_new" + d, d);
with ("block_new" + d) {
setProperty ("_root.block_new1", _x, 400);
setProperty ("_root.block_new1", _y, 100);
setProperty ("_root.block_new2", _x, 500);
setProperty ("_root.block_new2", _y, 250);
setProperty ("_root.block_new3", _x, 200);
setProperty ("_root.block_new3", _y, 250);
}
}
}
---------------------------Duplicating block and contolling User works fine
onClipEvent (load) {
while (d<3) {
d = d+1;
duplicateMovieClip ("_root.block", "block_new" + d, d);
with ("block_new" + d) {
setProperty ("_root.block_new1", _x, 400);
setProperty ("_root.block_new1", _y, 100);
setProperty ("_root.block_new2", _x, 500);
setProperty ("_root.block_new2", _y, 250);
setProperty ("_root.block_new3", _x, 200);
setProperty ("_root.block_new3", _y, 250);
}
}
}
onClipEvent (enterFrame) {
if (key.isDown(Key.DOWN)) {
if (_root.block_new + d.hitTest(_root.user._x, (_root.user._y+50), true) ne "true" {
setProperty ("_root.user", _y, (getProperty(_root.user, _y))+50);
}
}
if (key.isDown(Key.UP)) {
if (_root.block_new + d.hitTest(_root.user._x, (_root.user._y-50), true) ne "true" {
setProperty ("_root.user", _y, (getProperty(_root.user, _y))-50);
}
}
if (key.isDown(Key.LEFT)) {
if (_root.block_new + d.hitTest((_root.user._x-50), _root.user._y, true) ne "true" {
setProperty ("_root.user", _x, (getProperty(_root.user, _x))-50);
}
}
if (key.isDown(Key.RIGHT)) {
if (_root.block_new + d.hitTest((_root.user._x+50), _root.user._y, true) ne "true" {
setProperty ("_root.user", _x, (getProperty(_root.user, _x))+50);
}
}
}
thanks
Marc