Could anyone please tell me how I can reduce the delay of my object that moves if I use my arrow keys?
Here is the code of the movement:
Code: Select all
on arrowkey x
   
   --Controls
   if x is "up" then
      set the top of graphic "box" to the top of graphic "box" - 3
      if top of graphic "box" < 0 then
         set the top of graphic "box" to 0
      end if
      if intersect( graphic "box" , group "maze" , "opaque pixels") then
         set the bottom of graphic "box" to the bottom of graphic "box" + 3.1
      end if 
   end if
   
   if x is "down" then
      set the bottom of graphic "box" to the bottom of graphic "box" + 3
      if the bottom of graphic "box" > the bottom of card "mycard" then
         set the bottom of graphic "box" to the bottom of card "mycard"
      end if
      if intersect( graphic "box" , group "maze" , "opaque pixels") then
         set the bottom of graphic "box" to the bottom of graphic "box" - 3.1
      end if 
   end if
   
   if x is "left" then
      set the left of graphic "box" to the left of graphic "box" - 3
      if the left of graphic "box" < 0 then
         set the left of graphic "box" to 0
      end if
      if intersect( graphic "box" , group "maze" , "opaque pixels") then
         set the left of graphic "box" to the left of graphic "box" + 3.1
      end if 
   end if
   
   if x is "right" then
      set the right of graphic "box" to the right of graphic "box" + 3
      if right of graphic "box" > the right of card "mycard" then
         set the right of graphic "box" to the right of card "mycard"
      end if
      if intersect( graphic "box" , group "maze" , "opaque pixels") then
         set the right of graphic "box" to the right of graphic "box" - 3.1
      end if 
   end if
   --
end arrowKey
