PDA

View Full Version : [AS2] Asteroids are exploding when they hit the top left corner.


Scar
09-25-2008, 04:42 PM
First off, hello, hello. First post etc. I used to come here, back in the days, under a different name. Anyhoo.

I'm trying to develop a simple game of asteroids, which I'll later make more interesting.

My problem is, that there seems to be a mysterious invisible object in the top left of the flash file, that my asteroids are colliding with, and breaking apart.

My only idea is that it's most likely a bullet movieclip, because that's the only thing the asteroids are hitTesting for, before they explode.

If you're looking at my source, on the big asteroid to the right, there's some hitTest code, and the bullet that I duplicate is above it.

Thanks in advance for any hints or solutions!

farvan
09-25-2008, 04:50 PM
I can't see the reason why...but I must compliment you on your code...very clean and well put together.

Scar
09-25-2008, 04:58 PM
That's to stop me getting confused! =D

Scar
09-25-2008, 05:43 PM
Well I fixed it.

For future reference, and I'm sure it'll help someone, hitTest(xpos, ypos, true), if xpos and/or ypos are undefined it treats them as if they were 0.

So basically, when it was checking for all the instances of the bullets, it kept thinking that all the bullet's that didn't exist at the time, were at the top left corner.

:rolleyes:

Game developers, keep that in mind. I know I will XD