Exemplo n.º 1
0
        public static void Move(Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl sender, Microsoft.Graphics.Canvas.UI.Xaml.CanvasDrawEventArgs args)
        {
            for (int j = 0; j < MainPage.enemyXPOS.Count; ++j)
            {
                if (MainPage.enemySHIP[j] == 1)
                {
                    MainPage.SHIP_IMG = MainPage.Enemy1;
                }
                if (MainPage.enemySHIP[j] == 2)
                {
                    MainPage.SHIP_IMG = MainPage.Enemy2;
                }

                if (MainPage.enemyDIR[j] == "left")
                {
                    MainPage.enemyXPOS[j] -= 3;
                }
                else
                {
                    MainPage.enemyXPOS[j] += 3;
                }
                MainPage.enemyYPOS[j] += 3;

                args.DrawingSession.DrawImage(Scaling.img(MainPage.SHIP_IMG), MainPage.enemyXPOS[j], MainPage.enemyYPOS[j]);
            }
        }
Exemplo n.º 2
0
        private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
        {
            bounds = ApplicationView.GetForCurrentView().VisibleBounds;
            Scaling.SetScale();

            photonX = (float)bounds.Width / 2;
            photonY = (float)bounds.Height;
        }
Exemplo n.º 3
0
        public static void laser(Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl sender, Microsoft.Graphics.Canvas.UI.Xaml.CanvasDrawEventArgs args)
        {
            for (int i = 0; i < MainPage.photonXPOS.Count; ++i)
            {
                pointX = (photonX + (MainPage.photonXPOS[i] - photonX) * percent[i]);
                pointY = (photonY + (MainPage.photonYPOS[i] - photonY) * percent[i]);


                args.DrawingSession.DrawImage(Scaling.img(photon), pointX - (145 * scaleWidth), pointY - (145 * scaleHeight));


                percent[i] += (0.050f * scaleHeight);
                //Enemies
                foreach (Enemy Mob in MainPage.Enemies)
                {
                    Mob.Move();
                }

                for (int h = 0; h < MainPage.enemyXPOS.Count; ++h)
                {
                    if (pointX >= MainPage.enemyXPOS[h] && pointX <= MainPage.enemyXPOS[h] + (302 * scaleWidth) && pointY >= MainPage.enemyYPOS[h] && pointY <= MainPage.enemyYPOS[h] + (167 * scaleHeight))
                    {
                        boomX = pointX - (151 * scaleWidth);
                        boomY = pointY - (83 * scaleHeight);

                        MainPage.enemyXPOS.RemoveAt(h);
                        MainPage.enemyYPOS.RemoveAt(h);
                        MainPage.enemySHIP.RemoveAt(h);
                        MainPage.enemyDIR.RemoveAt(h);

                        MainPage.photonXPOS.RemoveAt(i);
                        MainPage.photonYPOS.RemoveAt(i);
                        MainPage.percent.RemoveAt(i);

                        Myscore = Myscore + 100;

                        break;
                    }
                }

                if (pointY < 0f)
                {
                    MainPage.photonXPOS.RemoveAt(i);
                    MainPage.photonYPOS.RemoveAt(i);
                    MainPage.percent.RemoveAt(i);
                }
            }

            //for (int i = 0; i<MainPage.photonXPOS.Count; ++i)
            //    {
            //                pointX = (photonX + (MainPage.photonXPOS[i] - photonX) * percent[i]);
            //                pointY = (photonY + (MainPage.photonYPOS[i] - photonY) * percent[i]);
            //    }

            //    for (int h = 0; h < MainPage.enemyXPOS.Count; ++h)
            //    {
            //        if (pointX >= MainPage.enemyXPOS[h] && pointX <= MainPage.enemyXPOS[h] + (302 * scaleWidth) && pointY >= enemyYPOS[h] && pointY <= enemyYPOS[h] + (167 * scaleHeight))
            //        {
            //            boomX = pointX - (151 * scaleWidth);
            //            boomY = pointY - (83 * scaleHeight);

            //            MainPage.enemyXPOS.RemoveAt(h);
            //            MainPage.enemyYPOS.RemoveAt(h);
            //            MainPage.enemySHIP.RemoveAt(h);
            //            MainPage.enemyDIR.RemoveAt(h);

            //            MainPage.photonXPOS.RemoveAt(i);
            //            MainPage.photonYPOS.RemoveAt(i);
            //            MainPage.percent.RemoveAt(i);

            //            Myscore = Myscore + 100;

            //            break;


            //        }


            //    }
        }