-
Hittest Question
Just having a play around with some hittest methods i thought of. Just need a few answers.
Can you set more than just 1 x and y coordinate in the hittest.
EG: if (b1.hitTest(b2._x-b2._width/2, b2._y +15 , b2_y - 15, true)) {
To me that seem it would check to see if b1 hits b2's left edge at b2._y - and + 15. Didnt work for me, do i have to rite up 2 seperate hittests for each point?.
-
I had a couple more goes and tryed to get it to work and i got it, i just added "or" and then repeted the hittest with a different coordinate and it works like a charm.
Thanks and way
-EDIT-
I have another question, does having function in function in function bad?
I have a seperate function to check each side for collision, i then have another function which finds out what direction the objects traverling and declairs when and when not to check for collision (So i have the collision functions in this function), I then have that function in the main function that runs the game.
Any advice?
-
Nested functions are okay. It's a perfectly natural thing, everyone does it.