Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-29-2003, 10:42 AM   #1
mullwaden
Rodent Scripting action
 
Join Date: Nov 2003
Location: Stockholm, Sweden
Posts: 66
Question hitTest in a little game

Im trying to do a simple little zelda rpg kind of game. I've made a little box that moves around now i want him to stop when i hits a certain object. I've made it work if that object is in the root of the movie (just like the moveable box), but if i put it inside another movieclip it doesn't work so basically:

doen't work
if (gubbe.hitTest(main.walls.wall)) {
} else if (Key.isDown(Key.LEFT)) {
this._x -= this.speed;
gubbe._rotation = 180;
}
works
if (gubbe.hitTest(wall)) {
} else if (Key.isDown(Key.LEFT)) {
this._x -= this.speed;
gubbe._rotation = 180;
}
mullwaden is offline   Reply With Quote
Old 11-29-2003, 10:47 AM   #2
boyzdynasty
Senior Member
 
boyzdynasty's Avatar
 
Join Date: Aug 2002
Location: Philly
Posts: 2,583
Default

do have the correct path to wall?

_root -> main -> walls -> wall ?

hmm...it depends also where this if statement is located.
boyzdynasty is offline   Reply With Quote
Old 11-29-2003, 10:53 AM   #3
mullwaden
Rodent Scripting action
 
Join Date: Nov 2003
Location: Stockholm, Sweden
Posts: 66
Default

its located in the root of the movie. In the root i have 3 layers one contains all the actionscripting, the other the moveable box and the third a movieclip in which i intend to implement the rest of the game (ie walls and stuff)
mullwaden is offline   Reply With Quote
Old 11-29-2003, 10:55 AM   #4
mullwaden
Rodent Scripting action
 
Join Date: Nov 2003
Location: Stockholm, Sweden
Posts: 66
Default

its weird, flash finds my wall wall when i use the target path button
mullwaden is offline   Reply With Quote
Old 11-29-2003, 10:56 AM   #5
boyzdynasty
Senior Member
 
boyzdynasty's Avatar
 
Join Date: Aug 2002
Location: Philly
Posts: 2,583
Default

ok...

try
ActionScript Code:
if (gubbe.hitTest(_root.main.walls.wall)) {....}
boyzdynasty is offline   Reply With Quote
Old 11-29-2003, 11:00 AM   #6
mullwaden
Rodent Scripting action
 
Join Date: Nov 2003
Location: Stockholm, Sweden
Posts: 66
Default

eeek i get tons of errors :S
mullwaden is offline   Reply With Quote
Old 11-29-2003, 11:05 AM   #7
mullwaden
Rodent Scripting action
 
Join Date: Nov 2003
Location: Stockholm, Sweden
Posts: 66
Default

heh ... maybe i can send it to you and can have a look? got msn or icq or irc ?
mullwaden is offline   Reply With Quote
Old 11-29-2003, 12:27 PM   #8
mullwaden
Rodent Scripting action
 
Join Date: Nov 2003
Location: Stockholm, Sweden
Posts: 66
Default

hmm seems that if i changed the name of main to something else it worked .... weird
mullwaden is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:48 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.