Exemplo n.º 1
0
 public Explosion(Texture2D textrue, Vector3 position)
 {
     sprite = new SimpleSprite( AppMain.graphics, textrue);
     sprite.Center.X = 0.5f;
     sprite.Center.Y = 0.5f;
     sprite.Position = position;
 }
Exemplo n.º 2
0
        public static void Initialize()
        {
            graphics = new GraphicsContext ();
            ImageRect rectScreen = graphics.Screen.Rectangle;
            generator = new Random ();

            dots = new List<SimpleSprite> ();
            //dots_2 = new List<SimpleSprite> ();
            hits = new List<Hits> ();
            //creating texture2D in prep for the Simple Sprites
            texture = new Texture2D ("/Application/resources/world.png", false);
            texture2 = new Texture2D ("/Application/resources/dot.png", false);
            texture3 = new Texture2D ("/Application/resources/dot_1.png", false);
            Atlanta = new Texture2D ("/Application/resources/Atlanta.png", false);
            Paris_1 = new Texture2D ("/Application/resources/Paris_01.png", false);
            Paris_2 = new Texture2D ("/Application/resources/Paris_02.png", false);
            Paris_3 = new Texture2D ("/Application/resources/Paris_03.png", false);
            Paris_4 = new Texture2D ("/Application/resources/Paris_04.png", false);
            LosAngeles = new Texture2D ("/Application/resources/LA.png", false);
            NewYork = new Texture2D ("/Application/resources/NYC.png", false);
            particle_Tex = new Texture2D ("/Application/resources/fire_particle.png", false);
            skyline_1_fire = new Texture2D ("/Application/resources/Paris_01_hit.png", false);
            skyline_2_fire = new Texture2D ("/Application/resources/Paris_02_hit.png", false);
            skyline_3_fire = new Texture2D ("/Application/resources/Paris_03_hit.png", false);
            skyline_4_fire = new Texture2D ("/Application/resources/Paris_04_hit.png", false);
            //create array to put different player maps in.
            SimpleSprite[] skylines = new SimpleSprite[]
            {
                ATL1 = new SimpleSprite (graphics, Atlanta),
                paris_1 = new SimpleSprite (graphics, Paris_1),
                LA = new SimpleSprite (graphics, LosAngeles),
                NYC = new SimpleSprite (graphics, NewYork),
                ATL = new SimpleSprite (graphics, Atlanta),
            };

            for (int s = 0; s <= skylines.Length; ++s) {
                if (s == Convert.ToInt32 (ID)) {

                    play_Sky_Line_1 = skylines [s];
                    play_Sky_Line_1.Position.X = 0;
                    play_Sky_Line_1.Position.Y = 0;

                }
                if (play_Sky_Line_1 == skylines [1]) {
                    play_Sky_Line_2 = new SimpleSprite (graphics, Paris_2);
                    play_Sky_Line_3 = new SimpleSprite (graphics, Paris_3);
                    play_Sky_Line_4 = new SimpleSprite (graphics, Paris_4);
                }
                if (play_Sky_Line_1 == skylines [2]) {
                    play_Sky_Line_2 = new SimpleSprite (graphics, Paris_2);
                    play_Sky_Line_3 = new SimpleSprite (graphics, Paris_3);
                    play_Sky_Line_4 = new SimpleSprite (graphics, Paris_4);
                }
                if (play_Sky_Line_1 == skylines [3]) {
                    play_Sky_Line_2 = new SimpleSprite (graphics, Paris_2);
                    play_Sky_Line_3 = new SimpleSprite (graphics, Paris_3);
                    play_Sky_Line_4 = new SimpleSprite (graphics, Paris_4);
                }
                if (play_Sky_Line_1 == skylines [4]) {
                    play_Sky_Line_2 = new SimpleSprite (graphics, Paris_2);
                    play_Sky_Line_3 = new SimpleSprite (graphics, Paris_3);
                    play_Sky_Line_4 = new SimpleSprite (graphics, Paris_4);
                }
                //if(skylines[s] == LA_1)
                //{//
                //play_Sky_Line_2 = skylines [LA_2];
                //play_Sky_Line_3 = skylines [LA_3];
                //play_Sky_Line_4 = skylines [LA_4];
                //}

            }
            play_Sky_Line_2.Position.X = 240;
            play_Sky_Line_2.Position.Y = 0;
            play_Sky_Line_3.Position.X = 480;
            play_Sky_Line_3.Position.Y = 0;
            play_Sky_Line_4.Position.X = 720;
            play_Sky_Line_4.Position.Y = 0;
            skyline_1 = new Rectangle (0, 410, Paris_1.Width, 134);
            //skyline_2 = new Rectangle(240, 410, Paris_2.Width, 134);
            //skyline_3 = new Rectangle(480, 410, Paris_3.Width, 134);
            //skyline_4 = new Rectangle(720, 410, Paris_4.Width, 134);

            World = new SimpleSprite (graphics, texture);
            Fire_skyline_1 = new SimpleSprite (graphics, skyline_1_fire);
            Fire_skyline_2 = new SimpleSprite (graphics, skyline_2_fire);
            Fire_skyline_3 = new SimpleSprite (graphics, skyline_3_fire);
            Fire_skyline_4 = new SimpleSprite (graphics, skyline_4_fire);
            yellow_Dot = new SimpleSprite (graphics, texture3);
            red_Dot = new SimpleSprite (graphics, texture2);
            particle = new SimpleSprite (graphics, particle_Tex);
            spriteArray [0] = red_Dot;
            spriteArray [1] = yellow_Dot;
        }
Exemplo n.º 3
0
        public void Initialize()
        {
            //graphics = new GraphicsContext();
            //UISystem.Initialize(graphics);
            Console.WriteLine("---- game scene -----");

            ImageRect rectScreen = AppMain.graphics.Screen.Rectangle;
            generator = new Random ();

            dots = new List<SimpleSprite> ();

            //dots_2 = new List<SimpleSprite> ();
            hits = new List<Hits> ();
            //creating texture2D in prep for the Simple Sprites
            //texture = new Texture2D ("/Application/resources/world.png", false);
            texture2 = new Texture2D ("/Application/resources/Bomb_mini.png", false);
            texture2_left = new Texture2D("/Application/resources/Bomb_mini_left.png", false);
            texture2_right = new Texture2D("/Application/resources/Bomb_mini_right.png", false);
            texture3 = new Texture2D ("/Application/resources/dot_1.png", false);
            Atlanta = new Texture2D ("/Application/resources/Atlanta.png", false);
            Paris_1 = new Texture2D ("/Application/resources/Paris_01.png", false);
            Paris_2 = new Texture2D ("/Application/resources/Paris_02.png", false);
            Paris_3 = new Texture2D ("/Application/resources/Paris_03.png", false);
            Paris_4 = new Texture2D ("/Application/resources/Paris_04.png", false);
            Atlanta_01 = new Texture2D("/Application/resources/Atlanta_01.png", false);
            Atlanta_02 = new Texture2D("/Application/resources/Atlanta_02.png", false);
            Atlanta_03 = new Texture2D("/Application/resources/Atlanta_03.png", false);
            Atlanta_04 = new Texture2D("/Application/resources/Atlanta_04.png", false);
            LA_01 = new Texture2D("/Application/resources/LA_01.png", false);
            LA_02 = new Texture2D("/Application/resources/LA_02.png", false);
            LA_03 = new Texture2D("/Application/resources/LA_03.png", false);
            LA_04 = new Texture2D("/Application/resources/LA_04.png", false);
            NYC_01= new Texture2D("/Application/resources/NYC_01.png", false);
            NYC_02= new Texture2D("/Application/resources/NYC_02.png", false);
            NYC_03= new Texture2D("/Application/resources/NYC_03.png", false);
            NYC_04= new Texture2D("/Application/resources/NYC_04.png", false);
            LosAngeles = new Texture2D ("/Application/resources/LA.png", false);
            NewYork = new Texture2D ("/Application/resources/NYC.png", false);
            particle_Tex = new Texture2D ("/Application/resources/fire_particle.png", false);
            skyline_1_fire = new Texture2D ("/Application/resources/Paris_01_hit.png", false);
            skyline_2_fire = new Texture2D ("/Application/resources/Paris_02_hit.png", false);
            skyline_3_fire = new Texture2D ("/Application/resources/Paris_03_hit.png", false);
            skyline_4_fire = new Texture2D ("/Application/resources/Paris_04_hit.png", false);
            explosionPic = new Texture2D("/Application/resources/GraySmoke.png",false);

            //create array to put different player maps in.
            SimpleSprite[] skylines = new SimpleSprite[]
            {
                ATL1 = new SimpleSprite (AppMain.graphics, Atlanta_01),//0
                paris_1 = new SimpleSprite (AppMain.graphics, Paris_1),//1
                LA = new SimpleSprite (AppMain.graphics, LA_01),
                NYC = new SimpleSprite (AppMain.graphics, NYC_01),
                ATL = new SimpleSprite (AppMain.graphics, Atlanta_01),
            };

            for (int s = 0; s <= skylines.Length; ++s) {
                if (s == Convert.ToInt32 (ID)) {

                    play_Sky_Line_1 = skylines [s];
                    play_Sky_Line_1.Position.X = 0;
                    play_Sky_Line_1.Position.Y = 0;

                }
                if (play_Sky_Line_1 == skylines [1]) {
                    play_Sky_Line_2 = new SimpleSprite (AppMain.graphics, Paris_2);
                    play_Sky_Line_3 = new SimpleSprite (AppMain.graphics, Paris_3);
                    play_Sky_Line_4 = new SimpleSprite (AppMain.graphics, Paris_4);
                }
                if (play_Sky_Line_1 == skylines [2]) {
                    play_Sky_Line_2 = new SimpleSprite (AppMain.graphics, LA_02);
                    play_Sky_Line_3 = new SimpleSprite (AppMain.graphics, LA_03);
                    play_Sky_Line_4 = new SimpleSprite (AppMain.graphics, LA_04);
                }
                if (play_Sky_Line_1 == skylines [3]) {
                    play_Sky_Line_2 = new SimpleSprite (AppMain.graphics, NYC_02);
                    play_Sky_Line_3 = new SimpleSprite (AppMain.graphics, NYC_03);
                    play_Sky_Line_4 = new SimpleSprite (AppMain.graphics, NYC_04);
                }
                if (play_Sky_Line_1 == skylines [4]) {
                    play_Sky_Line_2 = new SimpleSprite (AppMain.graphics, Atlanta_02);
                    play_Sky_Line_3 = new SimpleSprite (AppMain.graphics, Atlanta_03);
                    play_Sky_Line_4 = new SimpleSprite (AppMain.graphics, Atlanta_04);
                }
                //if(skylines[s] == LA_1)
                //{//
                //play_Sky_Line_2 = skylines [LA_2];
                //play_Sky_Line_3 = skylines [LA_3];
                //play_Sky_Line_4 = skylines [LA_4];
                //}

            }
            play_Sky_Line_2.Position.X = 240;
            play_Sky_Line_2.Position.Y = 0;
            play_Sky_Line_3.Position.X = 480;
            play_Sky_Line_3.Position.Y = 0;
            play_Sky_Line_4.Position.X = 720;
            play_Sky_Line_4.Position.Y = 0;
            skyline_1 = new Rectangle (0, 410, Paris_1.Width, 134);
            //skyline_2 = new Rectangle(240, 410, Paris_2.Width, 134);
            //skyline_3 = new Rectangle(480, 410, Paris_3.Width, 134);
            //skyline_4 = new Rectangle(720, 410, Paris_4.Width, 134);

            //World = new SimpleSprite (AppMain.graphics, texture);
            Fire_skyline_1 = new SimpleSprite (AppMain.graphics, skyline_1_fire);
            Fire_skyline_2 = new SimpleSprite (AppMain.graphics, skyline_2_fire);
            Fire_skyline_3 = new SimpleSprite (AppMain.graphics, skyline_3_fire);
            Fire_skyline_4 = new SimpleSprite (AppMain.graphics, skyline_4_fire);
            yellow_Dot = new SimpleSprite (AppMain.graphics, texture3);
            red_Dot = new SimpleSprite (AppMain.graphics, texture2);
            particle = new SimpleSprite (AppMain.graphics, particle_Tex);
            spriteArray [0] = red_Dot;
            spriteArray [1] = yellow_Dot;

            timeCount = new Sce.PlayStation.HighLevel.UI.Label();
            score = new Sce.PlayStation.HighLevel.UI.Label();
            labelOfScore = new Sce.PlayStation.HighLevel.UI.Label();
            labelSetting(timeCount,                    //time count
                         "30",
                         960/2 - 20,
                         0,
                         150,
                         100,
                         32,
                         FontStyle.Regular,
                         new UIColor(0, 0, 0, 255));
            timer = new System.Diagnostics.Stopwatch();//timer

            labelSetting(score,                       //score
                         "0",
                         960 - 100,
                         0,
                         150,
                         100,
                         20,
                         FontStyle.Regular,
                         new UIColor(0, 0, 0, 255));

            labelSetting(labelOfScore,                //score board
                         "Score: ",
                         960 - 200,
                         0,
                         150,
                         100,
                         20,
                         FontStyle.Regular,
                         new UIColor(0, 0, 0, 255));

            //heath bar -- saparate to 5 parts
            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            ImageBox healthIcon = new ImageBox();
            healthIcon.Image = new ImageAsset("/Application/resources/shield-grey.png");
            healthIcon.PivotType = PivotType.MiddleCenter;
            healthIcon.Width = healthIcon.Image.Width/4.5f;
            healthIcon.Height = healthIcon.Image.Height/4.5f;
            healthIcon.SetPosition(35,40);

            healthbar_01 = new ImageBox();
            healthbar_01.Image = new ImageAsset("/Application/resources/red-rectangle.jpg");
            healthbar_01.PivotType = PivotType.MiddleCenter;
            healthbar_01.Width = healthbar_01.Image.Width/4.5f;
            healthbar_01.Height = healthbar_01.Image.Height/4.5f;
            healthbar_01.SetPosition(100,40);

            healthbar_02 = new ImageBox();
            healthbar_02.Image = new ImageAsset("/Application/resources/red-rectangle.jpg");
            healthbar_02.PivotType = PivotType.MiddleCenter;
            healthbar_02.Width = healthbar_02.Image.Width/4.5f;
            healthbar_02.Height = healthbar_02.Image.Height/4.5f;
            healthbar_02.SetPosition(155,40);

            healthbar_03 = new ImageBox();
            healthbar_03.Image = new ImageAsset("/Application/resources/red-rectangle.jpg");
            healthbar_03.PivotType = PivotType.MiddleCenter;
            healthbar_03.Width = healthbar_03.Image.Width/4.5f;
            healthbar_03.Height = healthbar_03.Image.Height/4.5f;
            healthbar_03.SetPosition(210,40);

            healthbar_04 = new ImageBox();
            healthbar_04.Image = new ImageAsset("/Application/resources/red-rectangle.jpg");
            healthbar_04.PivotType = PivotType.MiddleCenter;
            healthbar_04.Width = healthbar_04.Image.Width/4.5f;
            healthbar_04.Height = healthbar_04.Image.Height/4.5f;
            healthbar_04.SetPosition(265,40);

            _uiScene.RootWidget.AddChildLast(timeCount);
            _uiScene.RootWidget.AddChildLast(score);
            _uiScene.RootWidget.AddChildLast(healthIcon);
            _uiScene.RootWidget.AddChildLast(healthbar_01);
            _uiScene.RootWidget.AddChildLast(healthbar_02);
            _uiScene.RootWidget.AddChildLast(healthbar_03);
            _uiScene.RootWidget.AddChildLast(healthbar_04);
            _uiScene.RootWidget.AddChildLast(labelOfScore);
            UISystem.SetScene(_uiScene); // create menu scene
        }