1 Reply Latest reply on May 9, 2006 7:19 AM by Applied CD

    Help needed with storing locH and locV locations in a List

    leewilson86 Level 1
      Hello,

      I am trying to store locH and locV locations in a list in the form of (locV, locH) so that when i call upon this poistion later it prints out as say (100, 200).

      However lingo is not liking this very much.

      Here is the i have so far

      vhList = [] -- this runs on the startmove event and is a movie script

      -- the following is a script which is attatched to my sprite

      v = sprite(me.spritenum).locV -20
      h = sprite(me.spritenum).locH

      vhList.append((v), (h))


      I keep getting errors. I know i could use the Loc command and store it into the list but i need the v and h variables to create a loc style coordination as well as have them as their own entities for locV and locH

      If anyone knows how i could solve this it would be very appreciated

      Cheers

      Lee
        • 1. Re: Help needed with storing locH and locV locations in a List
          Applied CD Level 1
          I assume you’ve already got vhlist defined as a global, but if not here’s your startmovie script:

          on startmovie
          global vhList
          vhList = []
          end

          then on your sprite you’ve got several choices:

          on someEvent me
          global vhList
          v = sprite(me.spritenum).locV -20
          h = sprite(me.spritenum).locH
          myCoord = [v,h]
          vhList.append(myCoord)
          end

          this will build a list of the form vhList=[[v1,h1],[v2,h2],[v3,h3]…]

          or you can use this:

          on someEvent me
          global vhList
          v = sprite(me.spritenum).locV -20
          h = sprite(me.spritenum).locH
          vhList.append(point(h,v))
          end

          this will build a list of the form vhList=[point(h1,v1),point(h2,v2),point(h3,v3),…]
          note that the point data type is (horizontal, vertical) not the other way around.