private void Form1_KeyUp(object sender, KeyEventArgs e) {//Stops movement when key is lifted MoveUp.Stop(); MoveDown.Stop(); MoveRight.Stop(); MoveLeft.Stop(); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { MoveUp.Begin(); // To make MoveUp controllable. MoveUp.Stop(); // Then force it stop. Translate.Y = -ScreenHeight; this.Dispatcher.BeginInvoke(new Action(MoveBack.Begin)); }
private void GameOver() { ZebraMover.Stop(); BlueMove.Stop(); PurpleMove.Stop(); GreenMove.Stop(); GameEnd.Visible = true; PlayAgainButton.Visible = true; //Stops orange car from moving MoveUp.Stop(); MoveDown.Stop(); MoveRight.Stop(); MoveLeft.Stop(); }
private void RootPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MouseY = e.GetPosition(this).Y; CurrentTranslate = Translate.Y; Translate.Y = CurrentTranslate; InputElement = (IInputElement)sender; InputElement.CaptureMouse(); if (MoveBack.GetCurrentState() == ClockState.Active) { MoveBack.Stop(); } if (MoveUp.GetCurrentState() == ClockState.Active) { MoveUp.Stop(); } RootPanel.MouseMove += RootPanel_MouseMove; }