4 Replies Latest reply on Mar 6, 2010 5:40 AM by NOCK2k8

    Intersecting a finish line


      Hey guys, I've been at this for days now and still not having any luck. Basically, I have created a maze, and when my character steps on a rectangle at the end of the maze I want to change to a 'Game Over' screen.  Here is the code that I need to detect a user pressing keyboard keys, and to loop the frame over and over again for the movie clips to work (otherwise I would have to have 15000 frames for one level):


      global gKeyState, gKey,


      on exitFrame me

        if gKeyState = #pressed then
          sendAllSprites(#keyPress, gKey)
        end if
        go to frame "Level1"


      I want to add code into there to deal with the intersection.  I have tried adding the following in:


        if sprite("down").intersects(sprite("finish")) then
           put "intersection!"
         end if


      And I get an error message stating:

      'Script Error: Object Expected

        if sprite("down").intersects(sprite("finish")) then'


      My movie sprite for the man is called 'down' (as he will be facing downwards on crossing the rectangle.  And the rectangle is named 'finish'.


      Any help would be greatly appreciated.


      P.S. I am aware that with that code I should get a message rather than changing screens, but that's all I want for now.


      Thanks in advance,