What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
I am kind of new to Flash 8, AS2.0, but not that new to programming so I understand somethings are not possible, I think this is one of them but figured I would ask.
There are a hundred squares on the stage and one circle.
If the circle runs into a square a hit should be registered.
Now lets say all the squares are named “Square#” where # is just some number between 1 and 100.
Is there a better way to register the hit then:
//this is the circle
//Do something with the hit
The reason I ask is that if I have a bunch of circles and square the thing slows down so much its impossible to do anything.
If there is a way to register a hit without checking every single name that would be a huge plus, I highly doubt that its possible, but any other tips to speed up the hitTest would be helpful, other then checking the hitTest once every like 6 frames or so.
Of course it’s possible, you just have to design your system so that you know what squares are in the immediate area of the circle, so you don’t have to test all at once. If you have four different areas of the screen, and four arrays full of squares, you can test only against the squares occupying the area that your circle is in.
There’s already a thread on square-circle collision, so just look through the forum and check it out… it’s already been talked about exhaustively. But, you don’t really need the MovieClip.hitTest() method here.
Like with any programming language, in ActionScript you can make things easy or hard on yourself. Honestly, I think anything is possible if you put your mind to it… but this particular problem really isn’t too difficult to manage; you just need to be a little more creative. :)
The quadrant thing is not a bad idea, I may try something along those lines.
I did check out the squares and circle thread, along with all the other hitTest threads I could find here, before I posted but that thread is more about concerned accuracy of the hit which is something that does not matter in my program, they all could be squares as far as I’m concerned I just said circle because it was a different shape so it would be easier to read.
Thanks for the feed back, if you have any other ideas please let me know