4 Replies Latest reply on Aug 27, 2007 7:51 AM by Newsgroup_User

    can anyone help me with a bit of script modifying?

      Hey guys, can anyone help me?

      Here is some script that makes my character obviously move and detects walls. I would like to modify the script so that when my character hits the right keydown, the sprite changes to cast member "right". I have tried and so far all i have done is succeed in making the cast member change but this then deactivates the walls. Any ideas??

      on exitFrame me
      if keyPressed(123) then
      end if

      if keyPressed(124) then
      end if

      if keyPressed(125) then
      end if

      if keyPressed(126) then
      end if

      on move me, dx, dy

      oldRect = sprite(me.spritenum).rect
      newRect = oldRect + rect(dx,dy,dx,dy)

      hitWall = FALSE
      repeat with i = 2 to 30
      if sendSprite(i,#hitWall,newRect) then
      hitWall = TRUE
      exit repeat
      end if
      end repeat

      if not hitWall then
      sprite(me.spriteNum).loc = sprite(me.spriteNum).loc + point(dx,dy)
      end if

      Many thanks.