Hit Test does not work...
- Gesh
-
Gesh
- Member since: Sep. 8, 2008
- Offline.
-
- Forum Stats
- Member
- Level 05
- Blank Slate
Ive copyed 2 types of codes for hit test that work on the tutorial example but when i put the same code in my own game the object just goes over/under the wall...
can any1 help me with this?
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
Need more info if you want help. Like, the code, the instance names, which version of actionscript, etc
- Gesh
-
Gesh
- Member since: Sep. 8, 2008
- Offline.
-
- Forum Stats
- Member
- Level 05
- Blank Slate
At 3/20/09 01:24 PM, Denvish wrote: Need more info if you want help. Like, the code, the instance names, which version of actionscript, etc
onClipEvent(enterFrame) {
if(_root.char.hitTest(_root.wall1)) {
this._y -=10;
}
}
This is the code the mc that can move's name is char and the barriar is wall1 so basicely when it hits the barriar it has to stop but it just move's trough it
- Yambanshee
-
Yambanshee
- Member since: Oct. 5, 2008
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
first off... dont copy code, learn code... secondly, try this: and tell us what happens
onClipEvent(enterFrame) {
if(this.hitTest(_root.wall1)) {
trace ("you have hit the wall");
}
}
- Gesh
-
Gesh
- Member since: Sep. 8, 2008
- Offline.
-
- Forum Stats
- Member
- Level 05
- Blank Slate
At 3/20/09 01:35 PM, Yambanshee wrote: first off... dont copy code, learn code... secondly, try this: and tell us what happens
onClipEvent(enterFrame) {
if(this.hitTest(_root.wall1)) {
trace ("you have hit the wall");
}
}
when i copy it a few times i learn it ...as for this code u gave me the same thing happens no hit ditection
- Yambanshee
-
Yambanshee
- Member since: Oct. 5, 2008
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
At 3/20/09 01:42 PM, Gesh wrote: when i copy it a few times i learn it ...as for this code u gave me the same thing happens no hit ditection
ok, the problem is then definitly hte fact that its not hitting correct, are you sure your instance names are all correct (caps sensitive). And remember instant names, not symbol names
- Gesh
-
Gesh
- Member since: Sep. 8, 2008
- Offline.
-
- Forum Stats
- Member
- Level 05
- Blank Slate
At 3/20/09 01:45 PM, Yambanshee wrote:At 3/20/09 01:42 PM, Gesh wrote: when i copy it a few times i learn it ...as for this code u gave me the same thing happens no hit ditectionok, the problem is then definitly hte fact that its not hitting correct, are you sure your instance names are all correct (caps sensitive). And remember instant names, not symbol names
I think we are getting to the problem...whats the diffarence betwean instance and symbol names ?
- Yambanshee
-
Yambanshee
- Member since: Oct. 5, 2008
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
problem identifiyd!
im guessing you know what a symbol name is (the name its given when you make it). When you add it to the stage, and click on it with the properties panel open (bttom of screen), at the far left top, you should see a drop down with (probably) the word movie clip on it. Right underneith that is a input box. THAT'S the instance name.
- Gesh
-
Gesh
- Member since: Sep. 8, 2008
- Offline.
-
- Forum Stats
- Member
- Level 05
- Blank Slate
At 3/20/09 02:00 PM, Yambanshee wrote: problem identifiyd!
im guessing you know what a symbol name is (the name its given when you make it). When you add it to the stage, and click on it with the properties panel open (bttom of screen), at the far left top, you should see a drop down with (probably) the word movie clip on it. Right underneith that is a input box. THAT'S the instance name.
Thanks alot banshee :D now i can put my epic idea into making :D TYVM!!!Ohh im so happy right now i think im gona go kill the cookie :D
- Yambanshee
-
Yambanshee
- Member since: Oct. 5, 2008
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
Ohh im so happy right now i think im gona go kill the cookie :D
no prob, pm me if u need more help
- fjgamer
-
fjgamer
- Member since: Aug. 15, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
This *must* be this guy's first attempt at coding anything in Flash.
Instance names have been necessary since, well, ever.
AS1 or AS2?


