コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: K1719/Demo11
 // 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();
 }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: K1719/Demo11
        // 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();
        }
コード例 #3
0
 // 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();
 }