Skip to content

Instantly share code, notes, and snippets.

@KRNKRS
Created March 24, 2013 03:08
Show Gist options
  • Select an option

  • Save KRNKRS/5230315 to your computer and use it in GitHub Desktop.

Select an option

Save KRNKRS/5230315 to your computer and use it in GitHub Desktop.
座標移動バグコード
void Update()
{
Move += Vel;
if (Move >= 0.5 ||
Move <= -4)
{
Vel = 0;
}
#region キー入力
//右が押されたら
if (Input.GetKeyDown(KeyCode.RightArrow) &&
!MoveFlag)
{
Vel = 0.01f;
}
else
{
MoveFlag = false;
}
//左が押されたら
if (Input.GetKeyDown(KeyCode.LeftArrow) &&
!MoveFlag)
{
Vel = -0.01f;
}
#endregion
transform.Translate(Move, 0, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment