-
[MX] hittest
Code:
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._x -=15;
}
if (Key.isDown(Key.RIGHT)) {
this._x +=15;
}
if (_root.mainchar, hitTest(_root.scene1right)) {
nextFrame();
} else {
}
}
i don't get why this doesn't work
p.s. i have the object mainchar on a different layer
-
Flactionscrish
its the if statement for the hitTest
if (_root.mainchar.hitTest(_root.scene1right)){
nextFrame();
}
ktu[k-two]
he who hesitates is lost; so i guess i'll wander intently
Are you sure this is real?
Life is Love, Love is Blind, Blind we go through Life.
Life isn't hard, dealing with your self is.
The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.
-
i now have this
Code:
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._x -=15;
}
if (Key.isDown(Key.RIGHT)) {
this._x +=15;
}
if (_root.mainchar.hitTest(_root.scene1right)){
nextFrame();
}
}
-
Flactionscrish
ktu[k-two]
he who hesitates is lost; so i guess i'll wander intently
Are you sure this is real?
Life is Love, Love is Blind, Blind we go through Life.
Life isn't hard, dealing with your self is.
The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.
-
-
Flactionscrish
I would do some testing to make sure you are referencing everything properly.
Make sure all the traces, trace what you expect.
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._x -=15;
}
if (Key.isDown(Key.RIGHT)) {
this._x +=15;
}
trace(_root.mainchar)
trace(_root.scene1right)
trace(_root.mainchar.hitTest(_root.scene1right));
if (_root.mainchar.hitTest(_root.scene1right)){
nextFrame();
}
}
Also, what object is supposed to go to the nextFrame()?
The object that has the clipEvent, or something else? Also, use the debugger to make sure everything goes correctly.
ktu[k-two]
he who hesitates is lost; so i guess i'll wander intently
Are you sure this is real?
Life is Love, Love is Blind, Blind we go through Life.
Life isn't hard, dealing with your self is.
The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.
-
well I just want the timeline to move to the next frame. But its not on the same layer as the mainchar
-
nope, didn't work. It gave me like a million undefined errors
-
do you want me to post my fla?
-
-
Flactionscrish
Here's the deal.
You forgot to give your MovieClips an instance name.
Give your mainchar and scene1right instance names.
Also, you can change the hitTest to - this.hitTest(_root.scene1right);
same thing as before..
The last thing, your next frame call when the hitTest it true, needs to say _root.nextFrame();
before you were referencing the timeline of the mainchar, which only had one frame.
Good luck
ktu[k-two]
he who hesitates is lost; so i guess i'll wander intently
Are you sure this is real?
Life is Love, Love is Blind, Blind we go through Life.
Life isn't hard, dealing with your self is.
The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|