Beispiel #1
0
 public CreditsMenu(GraphicsContext g, Vector2 scales) : base(g, scales, new Vector4(0, 0, 0, 255))
 {
     this.font = new Font(new Vector4(255, 255, 255, 255), true, scales, g);
     this.y    = 0;
     music     = new MP3Player("/Application/res/sound/credits.mp3");
     music.play();
 }
Beispiel #2
0
		public TitleMenu(GraphicsContext g, Vector2 scales) : base(g, scales, new Vector4(73, 102, 192, 255)) {
			font1 = new Font(new Vector4(255, 255, 255, 255), true, scales, g);
			font2 = new Font(new Vector4(255, 255, 0, 255), true, scales, g);
			
			sl = new SpriteLoader();
			sl.cargarImagen(cursor);
			sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width*scales.X), (int)(sl.getImage().Size.Height*scales.Y))));
			cu = sl.ImageToSprite(g);
			
			sl.cargarImagen(background);
			sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width*scales.X), (int)(sl.getImage().Size.Height*scales.Y))));
			bg = sl.ImageToSprite(g);
			
			sl.cargarImagen(dyna);
			sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width*scales.X), (int)(sl.getImage().Size.Height*scales.Y))));
			dy = sl.ImageToSprite(g);
				
			sl.cargarImagen(blaster);
			sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width*scales.X), (int)(sl.getImage().Size.Height*scales.Y))));
			bl = sl.ImageToSprite(g);	
			
			backgroundColor = Textures.CreateTexture(g.Screen.Width, g.Screen.Height, g, bgColor);
			bg.Position.X = graphics.Screen.Width / 2 - bg.Width / 2;
			bg.Position.Y = graphics.Screen.Height;
			
			this.sound = new MP3Player("/Application/res/sound/title.mp3");
			sound.play();
	
		}
Beispiel #3
0
        public MapMenu(int level, int map, GraphicsContext g, Vector2 scales) : base(g, scales, new Vector4(0, 0, 0, 255))
        {
            this.sl = new SpriteLoader();
            this.sl.cargarImagen(sprites);
            this.sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width *scales.X),
                                                                (int)(sl.getImage().Size.Height *scales.Y))));
            this.ss = new SpriteSheet(this.sl.getImage());

            this.stage      = ss.obtenerSprite(0, 0, (int)(79 * scales.X), (int)(13 * scales.Y), g);
            this.game_start = ss.obtenerSprite(0, (int)(14 * scales.Y), (int)(107 * scales.X), (int)(13 * scales.Y), g);
            this.level      = ss.obtenerSprite((int)(8 * level * scales.X), (int)(28 * scales.Y), (int)(6 * scales.X), (int)(13 * scales.Y), g);
            this.map        = ss.obtenerSprite((int)(8 * map * scales.X), (int)(28 * scales.Y), (int)(6 * scales.X), (int)(13 * scales.Y), g);

            sound = new MP3Player("/Application/res/sound/map_start.mp3");
            sound.play();
            //MP3Player.map_start.play();
            this.clock = new Stopwatch();
            this.clock.Start();
        }
Beispiel #4
0
        public LevelMenu(int level, GraphicsContext g, Vector2 scales) : base(g, scales, new Vector4(0, 0, 0, 0))
        {
            this.lev = level;

            this.sl = new SpriteLoader();
            this.sl.cargarImagen(sprites);
            this.sl.setImage(sl.getImage().Resize(new ImageSize((int)(sl.getImage().Size.Width *scales.X),
                                                                (int)(sl.getImage().Size.Height *scales.Y))));
            this.ss = new SpriteSheet(this.sl.getImage());

            this.bg    = ss.obtenerSprite(0, 0, (int)(256 * scales.X), (int)(160 * scales.Y), g);
            this.round = ss.obtenerSprite((int)(76 * scales.X), (int)(161 * scales.Y), (int)(49 * scales.X), (int)(14 * scales.Y), g);
            this.level = ss.obtenerSprite((int)(12 * (level - 1) * scales.X + 134 * scales.X), (int)(160 * scales.Y),
                                          (int)(12 * scales.X), (int)(14 * scales.Y), g);

            // TODO Arreglar parpadeo de ronda y nivel
            int    scale    = 2;
            Sprite levelaux = ss.obtenerSprite(12 * (level - 1) * scale + 134 * scale, 160 * scale, 12 * scale, 14 * scale, g);

            levelaux.SetColor(new Vector4(0, 0, 0, 255));
            Sprite roundaux = ss.obtenerSprite(76 * scale, 161 * scale, 49 * scale, 14 * scale, g);

            roundaux.SetColor(new Vector4(0, 0, 0, 255));

            Sprite[] roundFlicker = { this.round, roundaux };
            Sprite[] levelFlicker = { this.level, levelaux };
            Sprite[] head         = { ss.obtenerSprite(1,            (int)(160 * scales.Y), (int)(23 * scales.X), (int)(23 * scales.Y), g),
                                      ss.obtenerSprite((int)(23 * scales.X), (int)(160 * scales.Y), (int)(24 * scales.X), (int)(23 * scales.Y), g),
                                      ss.obtenerSprite((int)(48 * scales.X), (int)(160 * scales.Y), (int)(24 * scales.X), (int)(23 * scales.Y), g) };

            this.head         = new Animation(head, 12);
            this.roundFlicker = new Animation(roundFlicker, 5);
            this.levelFlicker = new Animation(levelFlicker, 5);

            switch (level)
            {
            case 1:
                this.x = (int)(graphics.Screen.Width / 2 - this.bg.Width / 2 + 18 * scales.X);
                this.y = (int)(134 * scales.Y);
                break;

            case 2:
                this.x = (int)(graphics.Screen.Width / 2 - this.bg.Width / 2 + 48 * scales.X);
                this.y = (int)(112 * scales.Y);
                break;

            case 3:
                this.x = (int)(graphics.Screen.Width / 2 - this.bg.Width / 2 + 66 * scales.X);
                this.y = (int)(168 * scales.Y);
                break;

            case 4:
                this.x = (int)(graphics.Screen.Width / 2 - this.bg.Width / 2 + 104 * scales.X);
                this.y = (int)(128 * scales.Y);
                break;

            case 5:
                this.x = (int)(graphics.Screen.Width / 2 - this.bg.Width / 2 + 154 * scales.X);
                this.y = (int)(120 * scales.Y);
                break;

            case 6:
                this.x = (int)(graphics.Screen.Width / 2 - this.bg.Width / 2 + 210 * scales.X);
                this.y = (int)(138 * scales.Y);
                break;

            case 7:
                this.x = (int)(graphics.Screen.Width / 2 - this.bg.Width / 2 + 210 * scales.X);
                this.y = (int)(104 * scales.Y);
                break;

            case 8:
                this.x = (int)(graphics.Screen.Width / 2 - this.bg.Width / 2 + 210 * scales.X);
                this.y = (int)(62 * scales.Y);
                break;
            }
            this.head.start();
            this.roundFlicker.start();
            this.levelFlicker.start();

            //MP3Player.level_start.play();
            this.sound = new MP3Player("/Application/res/sound/level_start.mp3");
            this.sound.play();

            this.clock = new Stopwatch();
            this.clock.Start();
        }