浏览代码

Move pointer moving into function

ApisNecros 2 年之前
父节点
当前提交
4ed0b022f3
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      starfish.js

+ 8 - 1
starfish.js

@@ -136,7 +136,14 @@ class CodeBox {
             }
         }
 
-        this.SetPointer(this.curr_direction[0], this.curr_direction[1]);
+        this.Move();
+    }
+
+    Move() {
+        const newX = this.pointer[0] + this.curr_direction[0];
+        const newY = this.pointer[1] + this.curr_direction[1];
+
+        this.SetPointer(newX, newY);
     }
 
     /**