private void JoyStick_KeyDown(object sender, KeyEventArgs e) { User_Control uc = new User_Control(); uc.Recenter_Location(); if (e.KeyCode == Keys.Down) { int walkto = uc.GetWalkway(); if (walkto == 2) { SharpControl.Client.Player.Location.Z += 0.5; } if (walkto == 3) { SharpControl.Client.Player.Location.X -= 0.5; } if (walkto == 0) { SharpControl.Client.Player.Location.Z -= 0.5; } if (walkto == 1) { SharpControl.Client.Player.Location.X += 0.5; } } if (e.KeyCode == Keys.Left) { SharpControl.Client.Player.Rotation.X -= 90; if (SharpControl.Client.Player.Rotation.X > 360) { SharpControl.Client.Player.Rotation.X -= 360; } if (SharpControl.Client.Player.Rotation.X < 0) { SharpControl.Client.Player.Rotation.X += 360; } } if (e.KeyCode == Keys.Up) { int walkto = uc.GetWalkway(); if (walkto == 0) { SharpControl.Client.Player.Location.Z += 0.5; } if (walkto == 1) { SharpControl.Client.Player.Location.X -= 0.5; } if (walkto == 2) { SharpControl.Client.Player.Location.Z -= 0.5; } if (walkto == 3) { SharpControl.Client.Player.Location.X += 0.5; } } if (e.KeyCode == Keys.Right) { SharpControl.Client.Player.Rotation.X += 90; if (SharpControl.Client.Player.Rotation.X > 360) { SharpControl.Client.Player.Rotation.X -= 360; } if (SharpControl.Client.Player.Rotation.X < 0) { SharpControl.Client.Player.Rotation.X += 360; } } }
private static void TP(Vector3 vec, User_Control uc) { try { while (SharpControl.Client.Player.Location.Y < 125) { SharpControl.Client.Player.Location.Y += 1; Thread.Sleep(100); } bool didaction = true; int actions = 0; while (didaction) { actions = 0; didaction = false; if ((int)vec.X < (int)SharpControl.Client.Player.Location.X) { SharpControl.Client.Player.Location.X--; didaction = true; actions++; } if ((int)vec.X > (int)SharpControl.Client.Player.Location.X) { SharpControl.Client.Player.Location.X++; didaction = true; actions++; } if ((int)vec.Z < (int)SharpControl.Client.Player.Location.Z) { SharpControl.Client.Player.Location.Z--; didaction = true; actions++; } if ((int)vec.Z > (int)SharpControl.Client.Player.Location.Z) { SharpControl.Client.Player.Location.Z++; didaction = true; actions++; } Thread.Sleep(100 * actions); } int godown = (int)(SharpControl.Client.Player.Location.Y - vec.Y); while (godown > 0) { SharpControl.Client.Player.Location.Y--; Thread.Sleep(100); godown -= 1; } } catch { tp.Abort(); } uc.button12.Enabled = false; uc.button10.Enabled = true; SharpControl.teleporting = false; uc.Recenter_Location(); }