gamemaker吧 关注:13,630贴子:95,041
  • 4回复贴,共1

斜向移动这样写效率如何?

取消只看楼主收藏回复

1L给度娘


IP属地:广东1楼2011-03-29 20:06回复
    l = keyboard_check(vk_left);
    r = keyboard_check(vk_right);
    u = keyboard_check(vk_up);
    d = keyboard_check(vk_down);
    h = 0.3 * (u or d);
    v = 0.3 * (l or r);
    x = max(x - (move_speed and l) *(l - h),0);
    x = min(x + (move_speed and r) *(r - h),640);
    y = max(y - (move_speed and u) *(u - v),0);
    y = min(y + (move_speed and d) *(d - v),480);


    IP属地:广东2楼2011-03-29 20:06
    回复
      哪方面有问题呢?


      IP属地:广东4楼2011-03-29 20:28
      回复

        额,用类似这样的设定么motion_set(dir,speed)


        IP属地:广东6楼2011-03-29 21:34
        回复
          我的写法效率果然不高啊,空跑100W次跟LS所说的方法差了差不多10秒


          IP属地:广东10楼2011-04-01 22:33
          回复