4 Replies Latest reply on May 16, 2006 9:51 AM by harry_eakins

    Help making game for the psp

    harry_eakins
      Ive just started on a project which is snake for the psp. I have made the snake move by spawning squares infront of the snake whilst removing them from the tail to go forward. so my snake consists of an array of movieclips of squares that is constantly increasing when the player eats the food. Is there any efficient way i could do a hit test so that if the head square of the snake hits any other square in the body it detects it?

      Also since this is my first ever project i know that my code will be messy and maybe inefficient, so could you please tell me where i am going wrong etc. Thankyou very much.

      PS - The collision function is near the bottom.

      Harry Eakins
        • 1. Re: Help making game for the psp
          kglad Adobe Community Professional & MVP
          yes, make all the body part movieclips subclips of one movieclip. you could then execute one hitTest between the head and the movieclip that contains the body part subclips.
          • 2. Help making game for the psp
            harry_eakins Level 1
            I see what you mean and have been trying to implement it however i cant find a way in which it would be possible. Could anyone possible give me some options because im stuck.

            So far i have made the head in a separate movie clip, however it detects collisions constantly. I make it so that the mcHead movieclip roams around, and the snake body simply follows it (see the attached code) however they collide all the time somehow.

            Thankyou for your help

            Harry Eakins
            • 3. Re: Help making game for the psp
              kglad Adobe Community Professional & MVP
              what's mClip? if it's a chlid of _root, and contains nothing other than the body movieclips, you can use a hitTest() between the head and mClip.

              otherwise, create an empty movieclip and attach your body part movieclips to that movieclip and use a hitTest() between it and the head.
              • 4. Help making game for the psp
                harry_eakins Level 1
                I have managed to get the collision detection working but there is another problem. I have made this Picture which shows that when in some places, the snake body movie clip and the collision detection movieclip are overlapping when i don't i dont want a collision to be detected. Can you see?

                Is there any way of preventing this?? for example can you make the area of the movie clip fit exactly to the objects inside them??

                Thankyou so much for your contributions

                Harry Eakins