// create a butterfly private void CreateButterfly() { butterfly = new Butterfly { LocationX = MyCanvas.Width / 2 - 75, LocationY = MyCanvas.Height / 2 - 66 }; // add to canvas MyCanvas.Children.Add(butterfly); // show in right location butterfly.SetLocation(); }
// game loop private void Timer_Tick(object sender, object e) { // move butterfly if (UpPressed) { butterfly.Move(); } // rotate butterfly if (LeftPressed) { butterfly.Rotate(-1); } if (RightPressed) { butterfly.Rotate(1); } // update butterfly location butterfly.SetLocation(); // collision butterfly with flowers CheckCollision(); }
// Game loop private void Timer_Tick(object sender, object e) { // Move Butterfly if (UpPressed) { butterfly.Move(); } // Rotate Butterfly //Debug.WriteLine(LeftPressed); // DEBUGGAUS if (LeftPressed) { butterfly.Rotate(-1); } if (RightPressed) { butterfly.Rotate(1); } // Update Butterfly location butterfly.SetLocation(); // Collision Butterfly with flowers CheckCollission(); }