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 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); } }
void CheckUserInput() { if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT)) { player.JumpRight(room); } else if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT)) { player.JumpLeft(room); } else { player.Jump(room); } } if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT)) { player.MoveRight(room); } if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT)) { player.MoveLeft(room); } if (SdlHardware.KeyPressed(SdlHardware.KEY_ESC)) { finished = true; } }
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 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]); }
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 PlayerTurn(ref bool endBattle, ref bool endPlayerTurn) { if (protecting) { Oneiric.g.Mcharacter.Defense /= 2; } 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)) { SelectedOption(ref endBattle, ref endPlayerTurn); } }
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 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)); }
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)); }
void CheckUserInput() { if (SdlHardware.KeyPressed(SdlHardware.KEY_Q)) { finished = true; } if (SdlHardware.KeyPressed(SdlHardware.KEY_H)) { HelpScreen help = new HelpScreen(); help.Run(); } if (canThrowDice) { if (SdlHardware.KeyPressed(SdlHardware.KEY_D)) { // Wait if key D is pressed while (SdlHardware.KeyPressed(SdlHardware.KEY_D)) { } ChangeTurn(); } } }
private void ComprobarPoderHuir() { if (r.Next(1, 100) >= 50 ? true : false) { do { DibujarInterfaz(); SdlHardware.WriteHiddenText("¡No has podido escapar!", 100, 560, 0xC0, 0xC0, 0xC0, font35); SdlHardware.ShowHiddenScreen(); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC)); } else { do { DibujarInterfaz(); SdlHardware.WriteHiddenText("Escapaste sin problemas", 100, 560, 0xC0, 0xC0, 0xC0, font35); SdlHardware.ShowHiddenScreen(); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC)); continuar = false; } }
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 static void CheckInputDevices() { // Read keys and calculate new position if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT) && CanMoveTo(x + pacSpeed, y, map)) { x += pacSpeed; } if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT) && CanMoveTo(x - pacSpeed, y, map)) { x -= pacSpeed; } if (SdlHardware.KeyPressed(SdlHardware.KEY_DOWN) && CanMoveTo(x, y + pacSpeed, map)) { y += pacSpeed; } if (SdlHardware.KeyPressed(SdlHardware.KEY_UP) && CanMoveTo(x, y - pacSpeed, map)) { y -= pacSpeed; } if (SdlHardware.KeyPressed(SdlHardware.KEY_ESC)) { gameFinished = true; } }
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 DetectarTeclas() { if (SdlHardware.KeyPressed(Tao.Sdl.Sdl.SDLK_BACKSPACE)) { SdlHardware.Pause(100); continuar = false; } }
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 DetectarTeclas() { SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { SdlHardware.Pause(100); continuar = false; } }
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(ref Jugador prota, short scrollX, short scrollY) { this.prota = prota; do { DibujarInterfaz(); DetectarTeclas(); SdlHardware.Pause(60); } while (!SdlHardware.KeyPressed(Tao.Sdl.Sdl.SDLK_BACKSPACE)); SdlHardware.ScrollTo(scrollX, scrollX); }
public static void Intro() { int x = -40; bool exitIntro = false; do { SdlHardware.ClearScreen(); SdlHardware.WriteHiddenText("Hit SPACE to start", 300, 400, 0xCC, 0xCC, 0xCC, sans18); SdlHardware.WriteHiddenText("or H for Help", 330, 440, 0xAA, 0xAA, 0xAA, sans18); SdlHardware.WriteHiddenText("or C for Credits", 310, 480, 0x88, 0x88, 0x88, sans18); SdlHardware.WriteHiddenText("or Q to Quit", 340, 520, 0x66, 0x66, 0x66, sans18); SdlHardware.DrawHiddenImage(enemyImage[0], x - 50, 300); SdlHardware.DrawHiddenImage(pacImage, x, 300); SdlHardware.ShowHiddenScreen(); x += 8; if (x > 850) { x = -40; } SdlHardware.Pause(20); if (SdlHardware.KeyPressed(SdlHardware.KEY_C)) { ShowCredits(); } if (SdlHardware.KeyPressed(SdlHardware.KEY_H)) { ShowHelp(); } if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { exitIntro = true; } if (SdlHardware.KeyPressed(SdlHardware.KEY_Q)) { exitIntro = true; sessionFinished = true; } }while (!exitIntro); }
public void Run() { option = 0; SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(welcome, 100, 0); SdlHardware.WriteHiddenText("1. Play", 30, 290, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("2. Credits", 30, 330, 0xA0, 0xA0, 0xA0, font24); SdlHardware.WriteHiddenText("3. Help", 30, 370, 0x80, 0x80, 0x80, font24); SdlHardware.WriteHiddenText("4. ScoreBoard", 30, 410, 0x80, 0x80, 0x80, font24); SdlHardware.WriteHiddenText("Q. Quit", 30, 450, 0x80, 0x80, 0x80, font24); SdlHardware.ShowHiddenScreen(); 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_4)) { option = 4; } if (SdlHardware.KeyPressed(SdlHardware.KEY_Q)) { option = 5; } SdlHardware.Pause(100); // To avoid using 100% CPU }while (option == 0); }
public void Run() { do { ChooseKeyToChange(); if (currentKeyChoosen) { SdlHardware.Pause(30); ChooseNewKey(); } SdlHardware.Pause(50); }while (!SdlHardware.KeyPressed(Controls.Cancel)); }
void UpdateWorld() { player.Move(room); for (int i = 0; i < room.NumEnemies; i++) { room.Enemies[i].Move(); } if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { player.Shot(); } }