Created
March 24, 2013 03:10
-
-
Save KRNKRS/5230318 to your computer and use it in GitHub Desktop.
座標移動訂正コード
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Update() | |
| { | |
| if (transform.position.x >= 0.5 || | |
| transform.position.x <= -4) | |
| { | |
| Vel = 0; | |
| } | |
| #region キー入力 | |
| //右が押されたら | |
| if (Input.GetKeyDown(KeyCode.RightArrow) && | |
| !MoveFlag) | |
| { | |
| Vel = 0.2f; | |
| } | |
| else | |
| { | |
| MoveFlag = false; | |
| } | |
| //左が押されたら | |
| if (Input.GetKeyDown(KeyCode.LeftArrow) && | |
| !MoveFlag) | |
| { | |
| Vel = -0.2f; | |
| } | |
| #endregion | |
| Debug.Log(Vel); | |
| transform.Translate(Vel, 0, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment