7 Replies Latest reply on Sep 15, 2006 8:26 PM by mirianam

    Water waves

    mirianam Level 1
      I get an error "Property list did not start with a property name.
      If anyone can help I would appreciate it.

      property pNumPoints, pRadius, pList, pOffset, pAngle

      on getPropertyDescriptionList me
      list = [:]
      addProp list, #pNumPoints, [#comment: "Number of Points", #format: #integer, #default: 25]
      addProp list, #pRadius, [#comment: "Radius", #format: #integer, #default: 12]
      return list
      end


      on beginSprite me
      pOffset = 0
      pAngle = 0
      end

      on exitFrame me
      pList = []
      spacing = 680/pNumpoints
      pOffset = pOffset + 2
      if pOffset > spacing then pOffset = 0

      --create bottom and sides
      add pList, [#vertex: point(680 + spacing, 0)]
      add pList, [#vertex: point(680 + spacing, 100)]
      add pList, [#vertex: point(0 - spacing, 100)]

      --add wave points
      repeat with i = 0 to pNumPoints

      --move the waves
      pAngle = pAngle - 1
      if pAngle < -90 then pAngle = 90

      --get the handle
      h = circlePoint(pAngle, pRadius)
      h2 = circlePoint(pAngle + 180, pRadius)



      add pList, [#vertex: [point(i*spacing-pOffset, 0), #handle1: h, #handle2: h2] ----------------------here is the error!
      end repeat

      --set the member
      mem = sprite(me.spriteNum).member
      mem.vertexList = pList
      mem.centreRegPoint = FALSE
      mem.originMode = #centre
      mem.closed = TRUE
      end

      -- the following handler returns the point on any circle
      -- given the angle and the radius
      on circlePoint, radius
      a = (float(angle-90)/360.0)*2.0*pi()
      x = cos*radius
      y = sin*radius
      return point(x.y)
        • 1. Re: Water waves
          Level 7
          mirianam wrote:
          > I get an error "Property list did not start with a property name.
          > If anyone can help I would appreciate it.
          >
          > property pNumPoints, pRadius, pList, pOffset, pAngle
          >
          > on getPropertyDescriptionList me
          > list = [:]
          > addProp list, #pNumPoints, [#comment: "Number of Points", #format:
          > #integer, #default: 25]
          > addProp list, #pRadius, [#comment: "Radius", #format: #integer,
          > #default: 12] return list
          > end

          For a start, "list" is a Lingo keyword. Does it work if you use a different
          variable name?

          Andrew


          • 2. Re: Water waves
            mirianam Level 1
            Thanks Andrew - but the problemis further down the code - the "getPropertyDescriptionList" is OK. I put in a marker where the problem occurs.
            The problem is on -
            add pList, [#vertex: [point(i*spacing-pOffset, 0), #handle1: h, #handle2: h2] ----------------------here is the error!
            Thanks you
            • 3. Re: Water waves
              Level 7
              mirianam wrote:
              > Thanks Andrew - but the problemis further down the code - the
              > "getPropertyDescriptionList" is OK. I put in a marker where the
              > problem occurs. The problem is on -
              > add pList, [#vertex: [point(i*spacing-pOffset, 0), #handle1: h,
              > #handle2: h2] ----------------------here is the error!

              You have a spurious [ in there after #vertex:

              Did you change the variable name "list" anyway?

              Andrew


              • 4. Re: Water waves
                mirianam Level 1
                Thank you Andrew I must have been staring at that for a lifetime and could not see it.
                And yes I did change list to pdlist just to make sure.

                But now another error comes up - "Variable used before asigned a vaue -

                on circlePoint angle, radius
                a = (float(angle-90)/360.0)*2.0*pi()
                x = cos*radius
                y = sin*radius
                return point(x,y)

                I'm sorry to ask again but can you help. (I am in brain meltdown)
                Thanks
                • 5. Re: Water waves
                  Level 7
                  mirianam wrote:
                  > Thank you Andrew I must have been staring at that for a lifetime and
                  > could not see it.
                  > And yes I did change list to pdlist just to make sure.
                  >
                  > But now another error comes up - "Variable used before asigned a vaue
                  >
                  > on circlePoint angle, radius
                  > a = (float(angle-90)/360.0)*2.0*pi()
                  > x = cos*radius
                  > y = sin*radius
                  > return point(x,y)
                  >
                  > I'm sorry to ask again but can you help. (I am in brain meltdown)

                  It's thinking you want variables called "cos" and "sin", rather than the
                  functions:-

                  on circlePoint me, angle, radius
                  a = (angle-90.0)/180*pi
                  x = cos(a)*radius
                  y = sin(a)*radius
                  return point(x,y)
                  end circlePoint

                  HTH

                  Andrew


                  • 6. Re: Water waves
                    mirianam Level 1
                    Thank you Andrew
                    Yes I think so too.
                    I will have a look at it tomorrow. It is very late here in Australia and I should be tuning the computer off

                    mm
                    • 7. Re: Water waves
                      mirianam Level 1
                      Hi Andrew
                      Yes you are right.
                      Thank you so very much for you help. I really appreciate it.
                      Now I have my waves animating - of course to my next challenge - introducing some randomness!
                      mm