1 Reply Latest reply on Jan 17, 2007 4:55 AM by Newsgroup_User

    Help with moving projectile

    pj20
      I am having problems getting this code to work i have the code below on frames 1 & 4 when i press the play button i get a script error saying property not found V.locH =v0.locH + t* Ux * speed * theta.cos which is in frame 4 can anyone help me to get this working thanks for any help...

      pj20






      FRAME1

      on exitFrame me
      global Ux, Uy, V, t, v0
      -- t is time interval
      -- V is position vector
      -- Ux is the component unit vector in the horizontal direction
      -- Uy is the component unit vector in the vertical direction
      Ux = 1
      Uy = 1

      global bottom

      sprite(1).trails = true
      --

      Global speed, theta, accel
      -- these values give the speed of the particle and the angle in radians
      speed = 100
      accel = 10
      theta = (-45*pi)/180
      -- 30 degees
      V0 = sprite(1).loc
      -- starting position vector
      t = 0
      end

      FRAME 2

      on exitFrame me
      global Ux,Uy, speed, theta, V,t, top, bottom, left, right, accel, v0
      t = t+.05
      -- horizontal
      V.locH = v0.LocH + t*Ux*speed*theta.cos
      -- vertical
      V.locV = v0.LocV + t*Uy*speed*theta.sin + accel*power(t,2)



      put V
      -- draw
      sprite(1).loc = V
      -- re-enter frame
      go the frame
      end