At 9:43 PM +0000 12/27/00, Jonathan Rees wrote:
>cheers irv,
>the location that you dont understand is : Each door will set the 
>position of the charecter in the next room. I cannot make it work
>I have tried:
>on the door :
>global gListOfInformation
>
>on enterFrame me
>   if sprite 41 intersects sprite(me.spriteNum) then
>     gListOfInformation = [point(41:200,42:300)]
>     go to "room02"
>   end
>end
>
>on the frame(room)
>global gListOfInformation
>
>on prepareFrame me  -- use prepare frame to only do this once
>    sprite(41).loc = gListOfInformation[41,42]
>    gListOfInformation = [:]  -- clear info
>end


Try this:

on enterFrame me
   if sprite 41 intersects sprite(me.spriteNum) then
     gListOfInformation = ["41": point(200,300)]
     go to "room02"
   end
end

on the frame(room)
global gListOfInformation

on prepareFrame me  -- use prepare frame to only do this once
    sprite(41).loc = gListOfInformation["41"]
    gListOfInformation = [:]  -- clear info
end

Using a list, the above gives you a general way to store and retrieve 
information.  But if you only need to store a single point, then you 
could do it using a single global with a better name:

global gCharacterNextLoc

on enterFrame me
   if sprite 41 intersets sprite(me.spriteNum) then
      gCharacterNextLoc = point(200, 300)
      go to "room2"
   end if
end

on the frame script:

global gCharacterNextLoc

on prepareFrame me
    sprite(41).loc = gCharacterNextLoc
end


The lesson of what I was trying to demonstrate was that instead of 
trying to send a message to a sprite that may or may not exist, store 
a value in a global, or store values in a global list, then retrieve 
the valueor values later from the global.

Irv

Irv


Irv
-- 
Lingo / Director / Shockwave development for all occasions.

        (Over two millions lines of Lingo code served!)

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to