public void Run() { Sound bgSound = new Sound("data/sonidos/pantalla_titulo.mp3"); bgSound.BackgroundPlay(); do { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("Pulsa Espacio para", 100, 550, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Continuar", 200, 600, 0xC0, 0xC0, 0xC0, font24); SdlHardware.ShowHiddenScreen(); SdlHardware.Pause(1); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC)); bgSound.StopMusic(); SdlHardware.Pause(100); }
public void NewLevel(ref int maxVelocidad, ref bool finished, ref Player player) { Game.level += 1; if (Game.numEnemies < 20) { if (Game.level % quantityLevelToBoss == 0) { Game.numEnemies++; } else { Game.numEnemies += 2; } } if (maxVelocidad < 25) { maxVelocidad += 1; } if (Game.level % quantityLevelToBoss == 0) { bossStage = true; soundBoss.BackgroundPlay(); Game.enemies.Add(new Boss()); } else { soundBoss.StopMusic(); bossStage = false; for (int i = 0; i < Game.numEnemies; i++) { Game.enemies.Add(new Enemy()); } } finished = false; Random rnd = new Random(); for (int i = 0; i < Game.enemies.Count; i++) { int randomX = rnd.Next(200, 800); int randomY = rnd.Next(50, 600); if (randomX > player.GetX() || randomX < player.GetX() || randomY > player.GetY() || randomY < player.GetY()) { Game.enemies[i].MoveTo(randomX, randomY); } Game.enemies[i].SetSpeed(rnd.Next(1, maxVelocidad), rnd.Next(1, maxVelocidad)); } for (int i = 0; i < Game.numEnemies; i++) { Game.enemyAlive.Add(true); } }
private void BuscarCombateSalvaje() { foreach (Hierba hierba in mapa.Hierbas) { if (protagonista.CollisionsWith(hierba)) { if (r.Next(1, 100) <= 5 ? true : false) { Combate combate = new Combate( ref protagonista, CargarPokemonSalvaje(), this); SdlHardware.ResetScroll(); bgSound.StopMusic(); combate.Run(); bgSound.BackgroundPlay(); } } } }
public Juego(Jugador protagonista, Sprite fondo, Sprite dialogo) { r = new Random(); bucle = true; this.protagonista = protagonista; font18 = new Font("data/Joystix.ttf", 18); this.fondo = fondo; this.dialogo = dialogo; mapa = new Mapa(); mapa.CargarMapa("data/mapa.txt"); dibujarDialogo = false; bgSound = new Sound("data/sonidos/fondo.mp3"); bgSound.BackgroundPlay(); }
public void Run() { bgSound.BackgroundPlay(); do { if (turno) { TuTurno(); } else { RivalAtaca(); } ComprobarVidas(); turno = turno ? false : true; SdlHardware.Pause(40); } while (continuar); SdlHardware.ScrollTo(juego.viejoScrollX, juego.viejoScrollY); bgSound.StopMusic(); }