Skip to main content
Apr 14, 2006 2:43 PM UTC
Answered

hitTest issues

Ive started writing the 'hitTest' code for the game, i wasnt sure how, since i hadnt' tried it before- but after a short tutorial it's simple enough. However, i am running into problems.

Currently, my stage is set up with a ship, that fires bullets, at the top of the stage, i have a long movie clip that will act as a 'wall', when the bullets collide with the wall they should stop moving, and 'blow up'. I have my animations, and all the fun stuff down- but my hit test isnt working one bit!

here is the code for the hit test- it runs in my main _root enterframe loop.

thanks.
This topic is closed to new replies. Start a new post to keep the conversation going.
kglad
kgladCorrect answer
Community Expert
Apr 18, 2006 2:43 PM UTC
you're creating 10 bullets but you're only checking a hitTest on 5 of them. that's a problem.

p.s. you don't need to remove your bullet movieclips because you're removing them when you reuse their depths during their creation.

17 replies

kglad
Community Expert
Community Expert
Apr 15, 2006 1:16 AM UTC
do you have movieclips on the _root timeline with instance (not library) names of tWall, bullet1, bullet2, bullet3, ...,bullet5?

are heights of your bullets and tWall sufficient that changing the _y property of the bullets by 30 at each increment would not cause the bullets to jump over tWall and fail to make contact?
Translate
Apr 17, 2006 1:27 PM UTC
kglad,
skipping over the wall, ill have to check that- i never even thought about that.

Everything is named properly- i have 'bullet' on my timeline- witch gets attached 'i' at the end, so they should be named correctly. and tWall is named correctly.
Translate
Apr 14, 2006 3:19 PM UTC
Hrm- id doesnt collide with anything..
Translate
kglad
Community Expert
Community Expert
Apr 14, 2006 2:49 PM UTC
is that code in a loop?
Translate
Apr 14, 2006 2:57 PM UTC
Kglad, yes- i will post up the entire frame of code

Translate