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

    can anyone help me with a bit of script modifying?

    hayz222
      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
      move(me,-5,0)
      end if


      if keyPressed(124) then
      move(me,5,0)
      end if


      if keyPressed(125) then
      move(me,0,5)
      end if

      if keyPressed(126) then
      move(me,0,-5)
      end if
      end

      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
      end

      Many thanks.