View Full Version : Glitchy HitTest Script.
Santa Clause
January 24th, 2009, 05:29 PM
Hey peoples,
I'm building a game and I keep having glitches when using 2 of these scripts in the same frame(Doesn't matter which layer):
onEnterFrame = function () {
if (survivor.hitTest(door) && coinsNeeded == 3) {
gotoAndStop("room9");
}
};
The second script I type keeps not working at all.
Even when the hittest is different like door2, door3, and the GoTo.
And yes if there's 2 doors I change the instance name of the door as well, this glitch is purely Flash based.
Could anyone explain this or help me out?
sam_vickery
January 24th, 2009, 05:51 PM
Hey peoples,
I'm building a game and I keep having glitches when using 2 of these scripts in the same frame(Doesn't matter which layer):
onEnterFrame = function () {
if (survivor.hitTest(door) && coinsNeeded == 3) {
gotoAndStop("room9");
}
};
The second script I type keeps not working at all.
Even when the hittest is different like door2, door3, and the GoTo.
And yes if there's 2 doors I change the instance name of the door as well, this glitch is purely Flash based.
Could anyone explain this or help me out?
its hard to say just from that code. Could you post the fla file
Santa Clause
January 24th, 2009, 06:01 PM
Alright, here goes:
(It's the bunch of frames that are having that glitch at the moment, the entire game is too big to upload.)
Santa Clause
February 5th, 2009, 01:53 AM
Sorry but, bump, no one even seems to bother with this(fairly)small problem.
JapanMan
February 5th, 2009, 11:36 AM
Hey peoples,
I'm building a game and I keep having glitches when using 2 of these scripts in the same frame(Doesn't matter which layer):
onEnterFrame = function () {
if ((survivor.hitTest(door)) && (coinsNeeded == 3)) {
gotoAndStop("room9");
}
};The second script I type keeps not working at all.
Even when the hittest is different like door2, door3, and the GoTo.
And yes if there's 2 doors I change the instance name of the door as well, this glitch is purely Flash based.
Could anyone explain this or help me out?
You left out a bunch of parenthesis, for one thing. I added them in bold. That should do it, I think. I'm pretty sure Flash just didn't know what was supposed to be grouped together in that script.
Santa Clause
February 6th, 2009, 03:34 PM
So basically if I use that code twice with your fixed script, it should work?
Since that was my point.
Example:
2 doors, now I can't make 2 doors in 1 room else that script messes up.
JapanMan
February 6th, 2009, 03:45 PM
you can, just give each door an different instance name. Example:
onEnterFrame = function () {
if ((survivor.hitTest(door1)) && (coinsNeeded == 3)) {
gotoAndStop("room9");
}
if ((survivor.hitTest(door2)) && (coinsNeeded == 3)) {
gotoAndStop("room9");
}
};And, of course, you can change the room it goes to or the names of the doors as you see fit, just change their instance name to match.
Santa Clause
February 6th, 2009, 04:33 PM
I'll give it a shot and of course I named my doors different numbers and room frames labels etc.
Thanks in advance!
**EDIT**
Strangely this works..
So weird that adding a few ('s solves the glitch.
I'll let you guys know if I experience any more problems in the future.
Thanks alot JapanMan! Masta plan! :D
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.