hitTest help
- TheMasterOfSprites
-
TheMasterOfSprites
- Member since: Dec. 14, 2002
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate
Hey, I am having an issue with my RPG. I didn't want to post asking for help again but I am lost. I keep trying to program a hitTest. The idea is that when an invisible square box hits my character it will move to the next scene, which is were I programmed my "Random Battle." So I have the random battle all set up and I have the box seeable right now for testing. The big problem is every time it hits the movie clip, which is inside another movie clip; it doesn't seem to do anything. Here is my coding on the player.
onClipEvent(enterFrame){
if(this.hitTest(_root.area.bot)){
nextScene();
}
}
Now, maybe you can't use a next scene action on a player, (player being the character that is hitting the box,) but if that is the case how do I go about solving my problem? I tried modifying the code and placing it in several places. Is there something fundamentally wrong with it?
- Johnny
-
Johnny
- Member since: Apr. 17, 2004
- Offline.
-
- Forum Stats
- Member
- Level 24
- Blank Slate
Perpetually looking for time to return to the arts.
- TheMasterOfSprites
-
TheMasterOfSprites
- Member since: Dec. 14, 2002
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate
- TheMasterOfSprites
-
TheMasterOfSprites
- Member since: Dec. 14, 2002
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate
- TheSongSalad
-
TheSongSalad
- Member since: Jan. 17, 2009
- Offline.
-
- Forum Stats
- Member
- Level 19
- Audiophile
perhaps _root.gotoAndStop(#); instead of nextscene();? the '#' would be the frame of your random battle.
- BillysProgrammer
-
BillysProgrammer
- Member since: Sep. 17, 2008
- Offline.
-
- Forum Stats
- Member
- Level 16
- Gamer
There is no nextScene() command I believe.
_root.gotoAndStop("SCENE_NAME", FRAME# to start, default 1); - TheMasterOfSprites
-
TheMasterOfSprites
- Member since: Dec. 14, 2002
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate
At 3/23/09 01:03 AM, BillysProgrammer wrote: There is no nextScene() command I believe.
_root.gotoAndStop("SCENE_NAME", FRAME# to start, default 1);
Didn't work.
- BillysProgrammer
-
BillysProgrammer
- Member since: Sep. 17, 2008
- Offline.
-
- Forum Stats
- Member
- Level 16
- Gamer
Then you have done something wrong, I know for a fact it worked on mine. I always test before I post.
- TheMasterOfSprites
-
TheMasterOfSprites
- Member since: Dec. 14, 2002
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate
At 3/23/09 12:58 AM, TheSongSalad wrote: perhaps _root.gotoAndStop(#); instead of nextscene();? the '#' would be the frame of your random battle.
That works, thank you, but I wish I could use scenes to organize.
- TheSongSalad
-
TheSongSalad
- Member since: Jan. 17, 2009
- Offline.
-
- Forum Stats
- Member
- Level 19
- Audiophile
- TheMasterOfSprites
-
TheMasterOfSprites
- Member since: Dec. 14, 2002
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate
At 3/23/09 01:50 AM, TheSongSalad wrote: you can. do you know how to name them?
I tried naming it, but it still didn't work.
- TheSongSalad
-
TheSongSalad
- Member since: Jan. 17, 2009
- Offline.
-
- Forum Stats
- Member
- Level 19
- Audiophile
i guess ask someone else, i just use frame numbers, sorry man.
- Kwing
-
Kwing
- Member since: Jul. 24, 2007
- Offline.
-
- Forum Stats
- Member
- Level 45
- Game Developer
Sorry, I can't quite say I know what you're asking. Perhaps a basic rundown of where the script is/what MC's you have, etc.
If I offer to help you in a post, PM me to get it. I often forget to revisit threads.
Want 180+ free PSP games? Try these links! - Flash - Homebrew (OFW)
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
Also not exactly clear on your problem, but try this
Add this function on the main timeline
function NS(){nextScene();}
With your code, first run a trace to check your hitTest is working
onClipEvent(enterFrame){
if(this.hitTest(_root.area.bot)){
trace("HIT");
nextScene();
}
}
If that outputs HIT when tested, remove the trace and replace the line nextScene(); with _root.NS();



