Изменения

м
Строка 1: Строка 1:  +
{{Устарело}}
 
''Это 14-ая глава перевода оригинального руководства по Dream Maker от разработчиков.''
 
''Это 14-ая глава перевода оригинального руководства по Dream Maker от разработчиков.''
   Строка 215: Строка 216:     
''walk'', ''step'', и ''get_step'' – инструкции для движения в заданном направлении.
 
''walk'', ''step'', и ''get_step'' – инструкции для движения в заданном направлении.
instructions are for movement in a fixed direction.
      
walk (Obj,Dir,Lag=0)
 
walk (Obj,Dir,Lag=0)
Строка 244: Строка 244:  
====Инструкция turn====
 
====Инструкция turn====
   −
''turn''  
+
 
instruction rotates a direction by the specified amount.
+
Инструкция ''turn'' поворачивает направление на указанную величину.
    
turn (Dir,Angle)
 
turn (Dir,Angle)
Dir is the initial direction.
+
Dir - начальное направление.
Angle is the angle to rotate.
+
Angle - угол поворота.
Returns the new direction.
+
Возвращает новое направление.
The angle is specified in degrees. For example, turn(NORTH,90) yields WEST, a 90 degrees rotation in the counter-clockwise direction. Negative angles may be specified to achieve clockwise rotations as well.
+
Угол указывается в градусах. Например, turn(NORTH,90) направляет на запад, разворачивая против часовой стрелки на 90 градусов. Для поворота по часовой стрелке используйте отрицательные значения углов.
 
  −
The following example defines a guard mob who paces back and forth continuously.
      +
В следующем примере представляется охранный моб, который непрерывно движется вперед-назад.
 
  mob/guard/New()
 
  mob/guard/New()
 
     ..()
 
     ..()
Строка 260: Строка 259:  
       if(!step(src,dir)) dir = turn(dir,180)
 
       if(!step(src,dir)) dir = turn(dir,180)
 
       sleep(30) //three seconds
 
       sleep(30) //three seconds
By changing the initial direction the guard is facing, he can be made to pace in the desired line. This example shows how you can use the existing walking algorithms for your own purpose--in this case a linear pacing algorithm. Rotating by 90 degrees or 45 degrees instead would produce motion in two dimensions instead of just one. Of course then the guard might wander off and neglect his duties!
+
Меняя первоначальное направление, в котором смотрит моб, можно задать шаг по нужной линии. Этот пример показывает вам как можно использовать алгоритмы движений в собственных целях--в данном случае линейный пошаговый алгоритм. Поворот на 90 или 45 градусов создаст движение в двух направлениях вместо одного. Конечно, тогда охранник может блуждать и пренебрегать своими обязанностями!
 
      
===walk_towards===
 
===walk_towards===
   −
The walk_towards, step_towards, and get_step_towards instructions move in the direction of another object. If the target object changes position, the walking algorithm automatically adjusts the direction of motion accordingly.
+
Инструкции walk_towards, step_towards, и get_step_towards двигаются в сторону другого объекта. Если объект меняет положение, алгоритм хождения (walking) автоматически корректирует направление движения соответственно.
    
walk_towards (Obj,Targ,Lag=0)
 
walk_towards (Obj,Targ,Lag=0)
 
step_towards (Obj,Targ)
 
step_towards (Obj,Targ)
 
get_step_towards (Obj,Targ)
 
get_step_towards (Obj,Targ)
Obj is the object to be moved.
+
Obj - передвигаемый объект.
Targ is the destination.
+
Targ - пункт назначения.
Lag is the delay between steps in 10$^th$s of seconds.
+
Lag - задержка между шагами в одну десятую секунды..
   −
The return values of these are the same as the fixed-direction movement instructions that have already been described. In fact, all movement instructions behave the same except for the specific stepping algorithm that is employed.
+
Их значения возвращения (return values) являются такими же, как у инструкций движения фиксированного направления, которые уже были описаны. На самом деле, все инструкции движения ведут себя одинаково кроме используемого алгоритма step.