Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var moveDelay = 0.5f;
- var gridSize = 1;
- var x = 0;
- var y = 0;
- var moveX = 0;
- var moveY = 0;
- function Start() {
- Move();
- }
- function Move() {
- while (true) {
- yield WaitForSeconds(moveDelay);
- // code here is executed once per 'move delay'.
- (check keys and change direction here)
- x += moveX;
- y += moveY;
- transform.position = Vector3 ( x * gridSize, 0, y * gridSize);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment