public void Run() { DrawWelcomeScreen(false); do { if (SdlHardware.KeyPressed(SdlHardware.KEY_1)) { option = 1; } if (SdlHardware.KeyPressed(SdlHardware.KEY_2)) { option = 2; } if (SdlHardware.KeyPressed(SdlHardware.KEY_3)) { option = 3; } if (SdlHardware.KeyPressed(SdlHardware.KEY_Q)) { option = 4; } if (SdlHardware.KeyPressed(SdlHardware.KEY_0) && activeTricks) { option = 5; } if (SdlHardware.KeyPressed(SdlHardware.KEY_Z)) { activeTricks = true; DrawWelcomeScreen(true); } SdlHardware.Pause(100); // To avoid using 100% CPU }while (option == 0); }
public void IntroducirNombre() { do { if (!nombreIntroducido) { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("Introduce tu nombre. ", 100, 100, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa espacio al terminar.", 50, 200, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText(nombrePJ, 100, 300, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText(errorNombre, 30, 400, 0xC0, 0xC0, 0xC0, font24); SdlHardware.ShowHiddenScreen(); IntroducirTecla(); } SdlHardware.Pause(100); } while (!nombreIntroducido); }
public void Run(ref bool finished) { option = 0; DrawMenu(); do { if (SdlHardware.KeyPressed(SdlHardware.KEY_1)) { SaveMenu save = new SaveMenu(playerToSave, false); SdlHardware.Pause(200); save.Run(); } if (SdlHardware.KeyPressed(SdlHardware.KEY_2)) { ChangeControlsMenu changeControls = new ChangeControlsMenu(); changeControls.Run(); } if (SdlHardware.KeyPressed(SdlHardware.KEY_3)) { finished = true; } SdlHardware.Pause(100); } while (!SdlHardware.KeyPressed(Controls.Cancel) && !finished); SdlHardware.Pause(200); }
public void Run() { option = 0; DrawMenu(); do { if (SdlHardware.KeyPressed(SdlHardware.KEY_1)) { option = 1; } if (SdlHardware.KeyPressed(SdlHardware.KEY_2)) { option = 2; } if (SdlHardware.KeyPressed(SdlHardware.KEY_3)) { option = 3; } if (SdlHardware.KeyPressed(SdlHardware.KEY_ESC)) { option = 4; } SdlHardware.Pause(100); }while (option == 0); }
void CheckUserInput() { if (SdlHardware.KeyPressed(Controls.Cancel)) { SdlHardware.Pause(300); pause = new PauseMenu(player); pause.Run(ref finished); } if (SdlHardware.KeyPressed(Controls.Right)) { player.MoveRight(room); } if (SdlHardware.KeyPressed(Controls.Left)) { player.MoveLeft(room); } if (SdlHardware.KeyPressed(Controls.Up)) { player.MoveUp(room); } if (SdlHardware.KeyPressed(Controls.Down)) { player.MoveDown(room); } }
public static void Run(int score, int maxScore) { SdlHardware.ClearScreen(); SdlHardware.WriteHiddenText(ChooseLanguage.lenguage["score"] + " " + score, 400, 350, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText(ChooseLanguage.lenguage["maxScore"] + " " + maxScore, 400, 300, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Q. " + ChooseLanguage.lenguage["quit"], 400, 530, 0x80, 0x80, 0x80, font24); SdlHardware.ShowHiddenScreen(); do { if (SdlHardware.KeyPressed(SdlHardware.KEY_Q)) { exit = 0; } SdlHardware.Pause(100); }while (exit != 0); }
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 ChooseName() { //DateTime pressTic, drawTic; //TimeSpan diff; //pressTic = DateTime.Now; //drawTic = DateTime.Now; //diff = drawTic - pressTic; int key = SdlHardware.DetectKey(); if (key != SdlHardware.KEY_SPC && key != SdlHardware.KEY_ESC && key != SdlHardware.KEY_UP && key != SdlHardware.KEY_DOWN && key != SdlHardware.KEY_LEFT && key != SdlHardware.KEY_RIGHT && key != SdlHardware.KEY_RETURN /*&& ((int) diff.TotalMilliseconds > 500)*/) { name += SdlHardware.KeyToString(key); } else if (key == SdlHardware.KEY_SPC && name.Length > 0) { name = name.Remove(name.Length - 1); } else if (key == SdlHardware.KEY_RETURN) { nameChosen = true; } SdlHardware.Pause(105); }
public void Run() { do { DrawMenu(); if (newGame) { do { DrawMenu(); if (!nameChosen) // when newGame == false there is no need to ask for a name { ChooseName(); } } while (!SdlHardware.KeyPressed(Controls.Accept)); } if (nameChosen || !newGame) { do { do { selectedSlot = ChooseSlot(); DrawMenu(); if (selectedSlot != 0) { SdlHardware.Pause(200); } } while (selectedSlot == 0); } while (!SdlHardware.KeyPressed(Controls.Accept)); } } while (!SdlHardware.KeyPressed(Controls.Cancel) && selectedSlot == 0); Save(SLOTS[selectedSlot - 1]); }
public void SaveMenu() { int optionSave = 0; const int YSECONDCURSOR_MAX = 2; const int YSECONDCURSOR_MIN = 0; SdlHardware.Pause(100); do { SdlHardware.DrawHiddenImage(greyBackground, 0, 0); SdlHardware.DrawHiddenImage(saveBackground, -100, 0); SdlHardware.DrawHiddenImage(selector, 200, 270 + 120 * optionSave); SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_W) && optionSave > YSECONDCURSOR_MIN) { optionSave--; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_S) && optionSave < YSECONDCURSOR_MAX) { optionSave++; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_RETURN)) { Oneiric.SaveGame("data/savedGames/" + (optionSave + 1) + "_game.save"); } SdlHardware.Pause(100); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_ESC)); }
private void GanarCombate() { do { DibujarInterfaz(); SdlHardware.WriteHiddenText(salvaje.GetNombre() + " enemigo se ha debilitado", 80, 560, 0xC0, 0xC0, 0xC0, font35); SdlHardware.WriteHiddenText("¡Has ganado!", 80, 590, 0xC0, 0xC0, 0xC0, font35); SdlHardware.ShowHiddenScreen(); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC)); SdlHardware.Pause(100); int dineroGanado = r.Next(cantidadMinima, cantidadMaxima); do { DibujarInterfaz(); SdlHardware.WriteHiddenText("Obtienes " + dineroGanado + " PokeDólares", 80, 560, 0xC0, 0xC0, 0xC0, font35); SdlHardware.ShowHiddenScreen(); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC)); prota.SetDinero(prota.GetDinero() + dineroGanado); continuar = false; SdlHardware.Pause(60); }
public int Run() { option = 0; LoadText(Oneiric.Languages[Oneiric.Language], "mainMenu"); do { SdlHardware.ClearScreen(); MoveLetters(); DrawMenu(); SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_W) && option > YCURSOR_MIN) { option--; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_S) && option < YCURSOR_MAX) { option++; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_ESC)) { option = YCURSOR_MAX; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_RETURN)) { return(option); } SdlHardware.Pause(100); }while (true); //The loop ends when an option is choosed. }
public void Run() { Image credits = new Image("data/credits.png"); Font font18 = new Font("data/Joystix.ttf", 18); Font font40 = new Font("data/Joystix.ttf", 40); player = new Player(); player.MoveTo(80, 538); player.SetSpeed(50, 0); do { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(credits, 0, 0); SdlHardware.WriteHiddenText("Thanks for playing", 50, 30, 0xCC, 0xCC, 0xCC, font18); SdlHardware.WriteHiddenText("Press R to Return", 680, 30, 0xCC, 0xCC, 0xCC, font18); SdlHardware.WriteHiddenText("Trivial by María", 220, 640, 0xCC, 0xCC, 0xCC, font40); player.DrawOnHiddenScreen(); SdlHardware.ShowHiddenScreen(); player.Move(); SdlHardware.Pause(100); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_R)); }
public void Run() { font24 = new Font("data/Joystix.ttf", 18); SdlHardware.ClearScreen(); // SdlHardware.DrawHiddenImage(); SdlHardware.WriteHiddenText("LEFT and RIGHT arrows to move", 300, 290, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Spacebar to jump", 300, 330, 0xA0, 0xA0, 0xA0, font24); SdlHardware.WriteHiddenText("Fire still not available", 300, 370, 0xA0, 0xA0, 0xA0, font24); SdlHardware.WriteHiddenText("R - Return to Welcome ", 300, 410, 0x80, 0x80, 0x80, font24); SdlHardware.ShowHiddenScreen(); do { SdlHardware.Pause(100); // To avoid using 100% CPU } while (!SdlHardware.KeyPressed(SdlHardware.KEY_R)); }
public void WriteOnHistory(string s) { history.Enqueue(s); history.Dequeue(); UpdateScreen(); SdlHardware.Pause(1000); }
public void ChooseNewKey() { if (!Controls.CheckKeysInUse()) { DrawMenu(); DrawBottomMessage("Invalid key. Choose again"); keyToChange = -1; currentKeyChoosen = false; } else { do { DrawMenu(); DrawBottomMessage("Press the new key"); pressedKey = SdlHardware.DetectKey(); }while (pressedKey < 0); if (pressedKey < 0) { DrawMenu(); DrawBottomMessage("Invalid Key"); } else { DrawMenu(); DrawBottomMessage("Key changed"); Controls.SwapKeys(keyToChange, pressedKey); newKeyChoosen = true; } SdlHardware.Pause(30); } }
public void Run() { bool endBattle = false; LoadText(Oneiric.Languages[Oneiric.Language], "battleTexts"); SdlHardware.Pause(100); PrepareBattle(); do { bool endPlayerTurn = false; do { PlayerTurn(ref endBattle, ref endPlayerTurn); UpdateScreen(); SdlHardware.Pause(100); } while (!endPlayerTurn); SdlHardware.Pause(500); if (!endBattle) { EnemyTurn(ref endBattle); UpdateScreen(); SdlHardware.Pause(100); } }while (!endBattle); }
private void CapturarPokemon() { SdlHardware.Pause(100); capturando = true; bool haEscapado = false; int tickBall = 1; string cadenaPuntos = ""; do { DibujarInterfaz(); SdlHardware.WriteHiddenText("Capturando a " + salvaje.GetNombre(), 100, 560, 0xC0, 0xC0, 0xC0, font35); for (int i = 0; i < tickBall; i++) { cadenaPuntos += ". "; } SdlHardware.WriteHiddenText(cadenaPuntos, 100, 590, 0xC0, 0xC0, 0xC0, font35); SdlHardware.ShowHiddenScreen(); if (r.Next(1, 100) >= 70 ? true : false) { haEscapado = true; } else { tickBall++; } if (tickBall == 3) { capturando = false; } } while (capturando && !haEscapado); if (haEscapado) { do { DibujarInterfaz(); SdlHardware.WriteHiddenText("¡El pokemon ha escapado!", 100, 560, 0xC0, 0xC0, 0xC0, font35); SdlHardware.ShowHiddenScreen(); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC)); capturando = false; } else { PokemonCapturado(); } }
public void Run() { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(loginImage, 340, 300); SdlHardware.ShowHiddenScreen(); SdlHardware.Pause(3000); }
public void DetectarTeclas() { if (SdlHardware.KeyPressed(Tao.Sdl.Sdl.SDLK_BACKSPACE)) { SdlHardware.Pause(100); continuar = false; } }
public void DrawBottomMessage(string message) { SdlHardware.WriteHiddenText(message, 100, 230, 0xC0, 0xC0, 0xC0, font); SdlHardware.Pause(200); }
public static void Main(string[] args) { SdlHardware.Init(1024, 768, 24, false); int xShip = 500; int xEnemy = 400; int xEnemy2 = 200; int enemySpeed = 5; int enemySpeed2 = -3; int finished = 0; Image ship = new Image("data/ship.png"); Image enemy1 = new Image("data/enemy1a.png"); Image enemy2 = new Image("data/enemy2a.png"); do { // Draw elements SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(enemy1, xEnemy, 200); SdlHardware.DrawHiddenImage(enemy2, xEnemy2, 250); SdlHardware.DrawHiddenImage(ship, xShip, 500); SdlHardware.ShowHiddenScreen(); // Process user input if (SdlHardware.KeyPressed(SdlHardware.KEY_ESC)) { finished = 1; } if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT)) { xShip += 10; } if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT)) { xShip -= 10; } // Update world if ((xEnemy <= 50) || (xEnemy >= 950)) { enemySpeed = -enemySpeed; } xEnemy += enemySpeed; if ((xEnemy2 <= 50) || (xEnemy2 >= 950)) { enemySpeed2 = -enemySpeed2; } xEnemy2 += enemySpeed2; // Check game status // (Not yet) // Pause until next frame SdlHardware.Pause(20); }while (finished == 0); }
public void DetectarTeclas() { if (SdlHardware.KeyPressed(SdlHardware.KEY_DOWN)) { if (seleccion == maxOpciones) { seleccion = 1; posicionFlecha = 200; } else { seleccion++; posicionFlecha += 50; } } if (SdlHardware.KeyPressed(SdlHardware.KEY_UP)) { if (seleccion == 1) { seleccion = maxOpciones; posicionFlecha = 500; } else { seleccion--; posicionFlecha -= 50; } } SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { switch (seleccion) { case 1:; Pokedex p = new Pokedex(prota); p.Run(); break; case 2: EquipoJugador ej = new EquipoJugador(prota); ej.Run(); break; case 3: VerMochila(); break; case 4: InformacionJugador ij = new InformacionJugador(prota); ij.Run(); break; case 5: prota.guardarJugador("partidas/" + prota.GetNombre() + ".txt", ref fondo, ref dialogo, juego.viejoScrollX, juego.viejoScrollY); GuardadoCompletado(); break; case 6: Instrucciones i = new Instrucciones(); i.Run(); break; case 7: continuar = false;; break; } SdlHardware.Pause(100); } if (SdlHardware.KeyPressed(Tao.Sdl.Sdl.SDLK_BACKSPACE)) { SdlHardware.Pause(100); continuar = false; } }
public void Run() { do { DibujarInterfaz(); DetectarTeclas(); SdlHardware.Pause(100); } while (continuar); }
public void DetectarTeclas() { SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { SdlHardware.Pause(100); continuar = false; } }
public Chest(string image, int rarity) : base(image) { this.rarity = rarity; maxItems = Game.rand.Next(rarity, rarity * 2 + 1); SdlHardware.Pause(40); items = new List <Item>(); AddItems(); }
private void TuTurno() { bool accion = false; do { DibujarInterfaz(); DibujarTuTurno(); SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_DOWN)) { if (seleccion == 3) { seleccion = 0; posicionFlecha = 560; } else { seleccion++; posicionFlecha += 50; } } if (SdlHardware.KeyPressed(SdlHardware.KEY_UP)) { if (seleccion == 0) { seleccion = 3; posicionFlecha = 710; } else { seleccion--; posicionFlecha -= 50; } } SdlHardware.Pause(40); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC)); SdlHardware.Pause(100); switch (seleccion) { case 0: TusAtaques(); break; case 1: CapturarPokemon(); break; case 2: AbrirMochila(ref accion); if (!accion) { TuTurno(); } break; case 3: ComprobarPoderHuir(); break; } }
public override void DibujarInterfaz() { SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("Pokedex", 100, 50, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Usa ARRIBA O ABAJO para desplazarte", 100, 100, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText((seleccion + 1) + " de " + pokedex.Count, 100, 150, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText(pokedex[seleccion], 100, 250, 0xC0, 0xC0, 0xC0, select); SdlHardware.DrawHiddenImage(dexImagenes[pokedex[seleccion]], 400, 250); SdlHardware.WriteHiddenText("Pulsa <-- para salir", 100, 600, 0xC0, 0xC0, 0xC0, font24); SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_DOWN)) { if (seleccion == pokedex.Count - 1) { seleccion = 0; } else { seleccion++; } } if (SdlHardware.KeyPressed(SdlHardware.KEY_UP)) { if (seleccion == 0) { seleccion = pokedex.Count - 1; } else { seleccion--; } } SdlHardware.Pause(40); }
public void Run() { // Display until the user presses ESC while (SdlHardware.KeyPressed(SdlHardware.KEY_ESC) == false) { SdlHardware.ClearScreen(); SdlHardware.WriteHiddenText("Change option with up and down arrows, change selected option with space", 40, 110, 0xCC, 0xCC, 0xCC, font18); SdlHardware.WriteHiddenText("High Resolution Mode: " + (configuration[0] ? "YES" : "NO"), 40, 310, (index == 0 ? (byte)0xCC : (byte)0xFF), 0xCC, 0xCC, font18); SdlHardware.ShowHiddenScreen(); SdlHardware.Pause(50); // So that we do not use a 100% CPU if (SdlHardware.KeyPressed(SdlHardware.KEY_DOWN)) { if (index < configuration.Length) { index++; } else { index = 0; } } if (SdlHardware.KeyPressed(SdlHardware.KEY_UP)) { if (index > 0) { index--; } else { index = configuration.Length - 1; } } if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { configuration[index] = !configuration[index]; } if (SdlHardware.KeyPressed(SdlHardware.KEY_ESC)) { return; } } }
public void Run() { do { DibujarJuego(); ComprobarTeclas(); GestionarConversaciones(); DetectarColisiones(); SdlHardware.Pause(40); } while (bucle); }