public override void DibujarInterfaz() { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("Nombre: " + prota.GetNombre(), 100, 50, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Genero: " + prota.GetGenero(), 100, 100, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Dinero: " + prota.GetDinero() + " PokeDólares", 100, 150, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Nº Pokemons diferentes ", 100, 200, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("atrapados: " + prota.GetPokemonsDiferentesCapturados(), 100, 250, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Medallas: 0", 100, 300, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Tiempo Jugado: " + prota.GetTiempoJugado(), 100, 350, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa <-- para salir", 100, 450, 0xC0, 0xC0, 0xC0, font24); SdlHardware.ShowHiddenScreen(); SdlHardware.Pause(40); }
public void Run() { Image welcome = new Image("data/credits.png"); Font font18 = new Font("data/Joystix.ttf", 18); SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(welcome, 0, 0); SdlHardware.WriteHiddenText("(Partial) Remake by Adrián", 10, 50, 0x57, 0xA6, 0x39, font18); SdlHardware.WriteHiddenText("R to Return", 420, 440, 0xFE, 0x00, 0x00, font18); SdlHardware.ShowHiddenScreen(); do { SdlHardware.Pause(100); // To avoid using 100% CPU }while (!SdlHardware.KeyPressed(SdlHardware.KEY_R)); }
public void DrawOnHiddenScreen() { for (int row = 0; row < mapHeight; row++) { for (int col = 0; col < mapWidth; col++) { int posX = col * tileWidth + leftMargin; int posY = row * tileHeight + topMargin; switch (levelData[row][col]) { case '1': SdlHardware.DrawHiddenImage(brick, posX, posY); break; case '2': SdlHardware.DrawHiddenImage(edge, posX, posY); break; case '3': SdlHardware.DrawHiddenImage(house, posX, posY); break; case '4': SdlHardware.DrawHiddenImage(barrel, posX, posY); break; } } } }
public void Run() { string[] text = { "Use arrow keys to move right, ", "left or up and down", "Press SPACE to put a bomb", "Beware of enemies that move, kill!", " ", "Press R to return" }; Image background = new Image("data/help.png"); Font font18 = new Font("data/Joystix.ttf", 18); SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(background, 0, 0); byte white = 200; short x = 440; short y = 400; short spacing = 40; for (int i = 0; i < text.Length; i++) { SdlHardware.WriteHiddenText(text[i], x, y, white, white, white, font18); white -= 20; y += spacing; } SdlHardware.ShowHiddenScreen(); do { SdlHardware.Pause(100); }while (!SdlHardware.KeyPressed(SdlHardware.KEY_R)); }
public void Run() { Image welcome = new Image("data/welcome.png"); Font font18 = new Font("data/Joystix.ttf", 18); SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(welcome, 0, 0); SdlHardware.WriteHiddenText("Bomberman by María", 40, 10, 0xCC, 0xCC, 0xCC, font18); SdlHardware.WriteHiddenText("R to Return", 460, 470, 0xBB, 0xBB, 0xBB, font18); SdlHardware.ShowHiddenScreen(); do { SdlHardware.Pause(100); // To avoid using 100% CPU } while (!SdlHardware.KeyPressed(SdlHardware.KEY_R)); }
public void Run() { Image welcome = new Image("data/credits.png"); Font font18 = new Font("data/Joystix.ttf", 18); SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(welcome, 0, 0); SdlHardware.WriteHiddenText("(Partial) Remake by Nacho", 360, 430, 0xCC, 0xCC, 0xCC, font18); SdlHardware.WriteHiddenText("R to Return", 460, 470, 0xBB, 0xBB, 0xBB, font18); SdlHardware.ShowHiddenScreen(); do { SdlHardware.Pause(100); // To avoid using 100% CPU }while (!SdlHardware.KeyPressed(SdlHardware.KEY_R)); }
public void Run() { Image credits = new Image("data/credits.png"); Font font18 = new Font("data/Joystix.ttf", 18); SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(credits, -100, -90); SdlHardware.WriteHiddenText("Asteroids Remake by Pablo", 390, 630, 0xCC, 0xCC, 0xCC, font18); SdlHardware.WriteHiddenText("R " + ChooseLanguage.lenguage["toReturn"], 20, 20, 0xBB, 0xBB, 0xBB, font18); SdlHardware.ShowHiddenScreen(); do { SdlHardware.Pause(100); // To avoid using 100% CPU }while (!SdlHardware.KeyPressed(SdlHardware.KEY_R)); }
public void Run() { option = 0; SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(welcome, 0, 0); SdlHardware.WriteHiddenText("1. Play", 830, 30, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("2. Credits", 830, 70, 0xA0, 0xA0, 0xA0, font24); SdlHardware.WriteHiddenText("Q. Quit", 830, 110, 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_Q)) { option = 3; } SdlHardware.Pause(100); // To avoid using 100% CPU }while (option == 0); }
public override void DibujarInterfaz() { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("Instrucciones: ", 100, 50, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("-Pulsa las flechas de control", 100, 150, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("para moverte / seleccionar opciones", 100, 200, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("-Pulsa Espacio para hablar con ", 100, 300, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Personajes/Interactuar en general", 100, 350, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("-Pulsa M para acceder al menú ", 100, 450, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa Espacio para cerrar esto", 100, 600, 0xC0, 0xC0, 0xC0, font24); SdlHardware.ShowHiddenScreen(); SdlHardware.Pause(40); }
private void DibujarInterfazSalvaje() { if (capturando) { SdlHardware.DrawHiddenImage(new Image("data/pokeball.png"), 700, 250); } else { salvaje.DrawOnHiddenScreen(); } SdlHardware.WriteHiddenText(salvaje.GetNombre(), 100, 100, 0, 0, 0, font24); SdlHardware.WriteHiddenText("Lvl: " + salvaje.GetNivel().ToString(), 100, 130, 0, 0, 0, font24); SdlHardware.WriteHiddenText("HP: " + salvaje.GetVida().ToString(), 100, 160, 0, 0, 0, font24); }
public static void Error() { do { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(new Image("data/menu_partidas.png"), 0, 0); SdlHardware.WriteHiddenText("Error Fatal", 100, 50, 0xC0, 0xC0, 0xC0, new Font("data/Joystix.ttf", 24)); SdlHardware.WriteHiddenText("Pulsa Espacio para volver", 100, 100, 0xC0, 0xC0, 0xC0, new Font("data/Joystix.ttf", 24)); SdlHardware.WriteHiddenText("a la pantalla principal", 100, 150, 0xC0, 0xC0, 0xC0, new Font("data/Joystix.ttf", 24)); SdlHardware.ShowHiddenScreen(); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC)); SdlHardware.Pause(100); Pokemon.Run(); }
private void GuardadoCompletado() { do { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("La partida se ha guardado", 100, 50, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("satisfactoriamente", 100, 100, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa Espacio para salir de ", 100, 200, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("la partida", 100, 250, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa <-- para volver atrás", 100, 400, 0xC0, 0xC0, 0xC0, font24); if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { SdlHardware.Pause(100); Pokemon.Run(); } SdlHardware.ShowHiddenScreen(); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC) && !SdlHardware.KeyPressed(Tao.Sdl.Sdl.SDLK_BACKSPACE)); }
public override void DibujarInterfaz() { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("Nueva Partida", 100, 100, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Cargar Partida", 100, 200, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Borrar Partida", 100, 300, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("<--", 600, Convert.ToInt16(posicionFlecha), 0xC0, 0xC0, 0xC0, font24); SdlHardware.ShowHiddenScreen(); }
public void DrawWelcomeScreen(bool tricks) { option = 0; SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(welcome, 0, 0); if (tricks) { SdlHardware.WriteHiddenText("0. " + ChooseLanguage.lenguage["tricks"], 400, 440, 0x80, 0x80, 0x80, font24); } //Menu: SdlHardware.WriteHiddenText("1. " + ChooseLanguage.lenguage["play"], 400, 470, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("2. " + ChooseLanguage.lenguage["controlsAndMore"], 400, 500, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("3. " + ChooseLanguage.lenguage["credits"], 400, 530, 0xA0, 0xA0, 0xA0, font24); SdlHardware.WriteHiddenText("Q. " + ChooseLanguage.lenguage["quit"], 400, 560, 0x80, 0x80, 0x80, font24); SdlHardware.ShowHiddenScreen(); }
private void DibujarInterfaz() { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("Pc de " + prota.GetNombre(), 100, 50, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa <-- para volver", 200, 100, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Sacar Pokemon", 100, 200, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Dejar Pokemon", 100, 250, 0xC0, 0xC0, 0xC0, font24); if (fallo) { SdlHardware.WriteHiddenText(mensajeError, 100, 400, 0xC0, 0xC0, 0xC0, font24); } SdlHardware.WriteHiddenText("<--", 400, posicionFlecha, 0xC0, 0xC0, 0xC0, font24); SdlHardware.ShowHiddenScreen(); SdlHardware.Pause(40); }
public void Run() { string[] text = { "Press D to throw the dice", "Your game piece will move to the next box", "Press A, B or C to choose the answer", "Wait your turn", "Actual player is indicated above", "Press Q to quit the game", " ", "Try to use arrow keys to move", "the player only in this screen", " ", "Press R to Return" }; Image background = new Image("data/board.png"); Font font18 = new Font("data/Joystix.ttf", 18); Player player = new Player(); player.MoveTo(430, 550); short playerSpeed = 4; byte color = 255; short x = 180; short y = 180; short spacing = 40; do { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(background, 0, 0); color = 255; y = 180; for (int i = 0; i < text.Length; i++) { SdlHardware.WriteHiddenText(text[i], x, y, color, color, color, font18); color -= 15; y += spacing; } player.DrawOnHiddenScreen(); SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT) && (player.GetX() < 600)) { player.ChangeDirection(Sprite.RIGHT); SdlHardware.ScrollHorizontally((short)(-playerSpeed)); player.MoveTo(player.GetX() + playerSpeed, player.GetY()); player.NextFrame(); } if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT) && (player.GetX() > 300)) { player.ChangeDirection(Sprite.LEFT); SdlHardware.ScrollHorizontally(playerSpeed); player.MoveTo(player.GetX() - playerSpeed, player.GetY()); player.NextFrame(); } SdlHardware.Pause(40); }while (!SdlHardware.KeyPressed(SdlHardware.KEY_R)); SdlHardware.ResetScroll(); }
public void Run() { chosenOption = MenuOption.Menu; Font font32 = new Font("data/Joystix.ttf", 32); Font font24 = new Font("data/Joystix.ttf", 24); Image background = new Image("data/imgRetro/menuBackground.png"); RetroLook = true; SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(background, 0, 0); string[] options = { "1. Start mission", "2. Help", "3. Credits","4. Hi-Scores", "5. Graphics: retro","0. Quit" }; SdlHardware.WriteHiddenText("Saboteur", 500, 80, 0xff, 0x00, 0x00, font32); for (int i = 0; i < options.Length; i++) { SdlHardware.WriteHiddenText(options[i], 500, (short)(140 + i * 40), 0xFF, 0xFA, 0x00, font24); } SdlHardware.ShowHiddenScreen(); do { SdlHardware.Pause(50); // To avoid 100% CPU usage if (SdlHardware.KeyPressed(SdlHardware.KEY_1)) { chosenOption = MenuOption.Game; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_2)) { chosenOption = MenuOption.Help; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_3)) { chosenOption = MenuOption.Credits; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_4)) { chosenOption = MenuOption.Scores; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_5)) { if (RetroLook) { options[4] = "5. Graphics: updated"; RetroLook = false; //background = new Image("data/imgUpdated/menuBackground.png"); } else { options[4] = "5. Graphics: retro"; RetroLook = true; //background = new Image("data/imgRetro/menuBackground.png"); } SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(background, 0, 0); SdlHardware.WriteHiddenText("Saboteur", 500, 80, 0xff, 0x00, 0x00, font32); for (int i = 0; i < options.Length; i++) { SdlHardware.WriteHiddenText(options[i], 500, (short)(140 + i * 40), 0xFF, 0xFA, 0x00, font24); } SdlHardware.ShowHiddenScreen(); } else if (SdlHardware.KeyPressed(SdlHardware.KEY_0)) { chosenOption = MenuOption.Exit; } }while (chosenOption == MenuOption.Menu); }
public void DrawMenu() { SdlHardware.DrawHiddenImage(Wallpaper, 0, 0); SdlHardware.WriteHiddenText(title[0, 0], 352, (short)(Convert.ToInt16(title[0, 1]) + 2), 0x00, 0x00, 0x00, font94); SdlHardware.WriteHiddenText(title[0, 0], 350, Convert.ToInt16(title[0, 1]), 0xFF, 0xFF, 0xFF, font94); SdlHardware.WriteHiddenText(title[1, 0], 424, (short)(Convert.ToInt16(title[1, 1]) + 2), 0x00, 0x00, 0x00, font94); SdlHardware.WriteHiddenText(title[1, 0], 422, Convert.ToInt16(title[1, 1]), 0xFF, 0xFF, 0xFF, font94); SdlHardware.WriteHiddenText(title[2, 0], 494, (short)(Convert.ToInt16(title[2, 1]) + 2), 0x00, 0x00, 0x00, font94); SdlHardware.WriteHiddenText(title[2, 0], 492, Convert.ToInt16(title[2, 1]), 0xFF, 0xFF, 0xFF, font94); SdlHardware.WriteHiddenText(title[3, 0], 566, (short)(Convert.ToInt16(title[3, 1]) + 2), 0x00, 0x00, 0x00, font94); SdlHardware.WriteHiddenText(title[3, 0], 564, Convert.ToInt16(title[3, 1]), 0xFF, 0xFF, 0xFF, font94); SdlHardware.WriteHiddenText(title[4, 0], 638, (short)(Convert.ToInt16(title[4, 1]) + 2), 0x00, 0x00, 0x00, font94); SdlHardware.WriteHiddenText(title[4, 0], 636, Convert.ToInt16(title[4, 1]), 0xFF, 0xFF, 0xFF, font94); SdlHardware.WriteHiddenText(title[5, 0], 710, (short)(Convert.ToInt16(title[5, 1]) + 2), 0x00, 0x00, 0x00, font94); SdlHardware.WriteHiddenText(title[5, 0], 708, Convert.ToInt16(title[5, 1]), 0xFF, 0xFF, 0xFF, font94); SdlHardware.WriteHiddenText(title[6, 0], 782, (short)(Convert.ToInt16(title[6, 1]) + 2), 0x00, 0x00, 0x00, font94); SdlHardware.WriteHiddenText(title[6, 0], 780, Convert.ToInt16(title[6, 1]), 0xFF, 0xFF, 0xFF, font94); SdlHardware.WriteHiddenText(texts["co"], 422, 482, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["co"], 420, 480, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["ng"], 422, 522, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["ng"], 420, 520, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["lg"], 422, 562, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["lg"], 420, 560, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["op"], 422, 602, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["op"], 420, 600, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["hl"], 422, 642, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["hl"], 420, 640, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["ex"], 422, 682, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["ex"], 420, 680, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.DrawHiddenImage(selector, 320, 460 + 40 * option); }
public static void DrawElements() { // Draw SdlHardware.ClearScreen(); //Console.Write("Score: {0}",score); // Background map for (int row = 0; row < 15; row++) { for (int column = 0; column < 17; column++) { if (map[row][column] == '-') { SdlHardware.DrawHiddenImage(wallImage, column * 32, row * 32); } } } for (int i = 0; i < amountOfDots; i++) { if (dots[i].visible) { if (dots[i].isBig) { SdlHardware.DrawHiddenImage(bigDotImage, dots[i].x, dots[i].y); } else { SdlHardware.DrawHiddenImage(dotImage, dots[i].x, dots[i].y); } } } SdlHardware.DrawHiddenImage(pacImage, x, y); for (int i = 0; i < amountOfEnemies; i++) { if (enemies[i].visible) { if (ghostCatchingMode) { SdlHardware.DrawHiddenImage(enemyGreyImage, (int)enemies[i].x, (int)enemies[i].y); } else { SdlHardware.DrawHiddenImage(enemyImage[i], (int)enemies[i].x, (int)enemies[i].y); } } } SdlHardware.WriteHiddenText("Score: " + score, 610, 100, 0x80, 0x80, 0xFF, sans18); SdlHardware.WriteHiddenText("Lives: " + lives, 610, 140, 0x80, 0x80, 0xFF, sans18); SdlHardware.ShowHiddenScreen(); }
public void Run() { string[] text = { "Use arrow keys to move right or left", "Use spacebar to jump", "Arrows + spacebar to jump sidewards", "Beware of the moving enemies", "Press Q to quit the game", " ", "Press R to Return" }; Image background = new Image("data/help.png"); Font font18 = new Font("data/Joystix.ttf", 18); Player player = new Player(); player.MoveTo(510, 558); short playerSpeed = 4; byte grey = 200; short x = 300; short y = 250; short spacing = 40; do { // Draw items on screen SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(background, 0, 0); grey = 200; y = 250; for (int i = 0; i < text.Length; i++) { SdlHardware.WriteHiddenText(text[i], x, y, grey, grey, grey, font18); grey -= 20; y += spacing; } player.DrawOnHiddenScreen(); SdlHardware.ShowHiddenScreen(); // Animate the player (it is must fall or jump) player.Move(); // Get user input to move the player as desired if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT) && (player.GetX() < 700)) { player.ChangeDirection(Sprite.RIGHT); SdlHardware.ScrollHorizontally((short)(-playerSpeed)); player.MoveTo(player.GetX() + playerSpeed, player.GetY()); player.NextFrame(); } if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT) && (player.GetX() > 300)) { player.ChangeDirection(Sprite.LEFT); SdlHardware.ScrollHorizontally(playerSpeed); player.MoveTo(player.GetX() - playerSpeed, player.GetY()); player.NextFrame(); } // And pause (25 fps) SdlHardware.Pause(40); }while (!SdlHardware.KeyPressed(SdlHardware.KEY_R)); SdlHardware.ResetScroll(); }
public void cargarJugador(string partida, ref Sprite fondo, ref Sprite dialogo) { try { SdlHardware.DrawHiddenImage(new Image("data/cargando.png"), 0, 0); SdlHardware.ShowHiddenScreen(); StreamReader leer = new StreamReader(partida); nombre = leer.ReadLine(); genero = leer.ReadLine(); if (genero == "Hombre") { CargarHombre(); } else { CargarMujer(); } dinero = Convert.ToInt32(leer.ReadLine()); pokemonsDiferentesCapturados = Convert.ToInt32(leer.ReadLine()); tiempoJugado = Convert.ToInt32(leer.ReadLine()); this.x = Convert.ToInt32(leer.ReadLine()); this.y = Convert.ToInt32(leer.ReadLine()); fondo.x = Convert.ToInt32(leer.ReadLine()); fondo.y = Convert.ToInt32(leer.ReadLine()); dialogo.x = Convert.ToInt32(leer.ReadLine()); dialogo.y = Convert.ToInt32(leer.ReadLine()); SdlHardware.startX = Convert.ToInt16(leer.ReadLine()); SdlHardware.startY = Convert.ToInt16(leer.ReadLine()); string linea = leer.ReadLine(); int i = 0; while (linea != null) { string[] cortar = linea.Split(';'); equipo.Add(new Bestia( cortar[1], cortar[0])); equipo[i].SetNivel(Convert.ToInt32(cortar[2])); equipo[i].SetVida(Convert.ToInt32(cortar[3])); equipo[i].SetMaxVida(Convert.ToInt32(cortar[4])); string[] auxCortar = cortar[5].Split('_'); foreach (string s in auxCortar) { string[] auxAuxCortar = s.Split(':'); equipo[i].GetAtaques().Add(new ataque(auxAuxCortar[0], auxAuxCortar[1], Convert.ToInt32(auxAuxCortar[2]))); } linea = leer.ReadLine(); i++; } leer.Close(); leer = new StreamReader(partida + "_caja.txt"); linea = leer.ReadLine(); i = 0; while (linea != null) { string[] cortar = linea.Split(';'); caja.Add(new Bestia( cortar[1], cortar[0])); caja[i].SetNivel(Convert.ToInt32(cortar[2])); caja[i].SetVida(Convert.ToInt32(cortar[3])); caja[i].SetMaxVida(Convert.ToInt32(cortar[4])); string[] auxCortar = cortar[5].Split('_'); foreach (string s in auxCortar) { string[] auxAuxCortar = s.Split(':'); caja[i].GetAtaques().Add(new ataque(auxAuxCortar[0], auxAuxCortar[1], Convert.ToInt32(auxAuxCortar[2]))); } linea = leer.ReadLine(); i++; } leer.Close(); leer = new StreamReader(partida + "_mochila.txt"); linea = leer.ReadLine(); while (linea != null) { string[] cortar = linea.Split(';'); switch (cortar[0]) { case "Pocion": mochila.Add(new Pocion(cortar[1], Convert.ToInt32(cortar[2])), Convert.ToInt32(cortar[3])); break; } linea = leer.ReadLine(); } leer.Close(); } catch (Exception e) { Menu.Error(); } }
public void guardarJugador(string partida, ref Sprite fondo, ref Sprite dialogo, int scrollX, int scrollY) { try { SdlHardware.DrawHiddenImage(new Image("data/cargando.png"), 0, 0); SdlHardware.ShowHiddenScreen(); StreamWriter escribir = new StreamWriter(partida); escribir.WriteLine(nombre); escribir.WriteLine(genero); escribir.WriteLine(dinero); escribir.WriteLine(pokemonsDiferentesCapturados); escribir.WriteLine(0); escribir.WriteLine(this.x); escribir.WriteLine(this.y); escribir.WriteLine(fondo.x); escribir.WriteLine(fondo.y); escribir.WriteLine(dialogo.x); escribir.WriteLine(dialogo.y); escribir.WriteLine(scrollX); escribir.WriteLine(scrollY); foreach (Bestia bestia in equipo) { escribir.Write(bestia.image.nombre + ";" + bestia.GetNombre() + ";" + bestia.GetNivel() + ";" + bestia.GetVida() + ";" + bestia.GetMaxVida() + ";"); for (int i = 0; i < bestia.GetAtaques().Count; i++) { escribir.Write(bestia.GetAtaques()[i].nombre); escribir.Write(":" + bestia.GetAtaques()[i].tipo); escribir.Write(":" + bestia.GetAtaques()[i].poder); if (i < bestia.GetAtaques().Count - 1) { escribir.Write("_"); } } escribir.WriteLine(); } escribir.Close(); escribir = new StreamWriter(partida + "_caja.txt"); foreach (Bestia bestia in caja) { escribir.Write(bestia.image.nombre + ";" + bestia.GetNombre() + ";" + bestia.GetNivel() + ";" + bestia.GetVida() + ";" + bestia.GetMaxVida() + ";"); for (int i = 0; i < bestia.GetAtaques().Count; i++) { escribir.Write(bestia.GetAtaques()[i].nombre); escribir.Write(":" + bestia.GetAtaques()[i].tipo); escribir.Write(":" + bestia.GetAtaques()[i].poder); if (i < bestia.GetAtaques().Count - 1) { escribir.Write("_"); } } escribir.WriteLine(); } escribir.Close(); escribir = new StreamWriter(partida + "_mochila.txt"); foreach (KeyValuePair <Objeto, int> kp in mochila) { if (kp.Key.GetType().Name == "Pocion") { escribir.WriteLine(kp.Key.GetType().Name + ";" + kp.Key.Nombre + ";" + ((Pocion)kp.Key).hpRecuperados + ";" + kp.Value); } } escribir.Close(); } catch (Exception e) { Menu.Error(); } }
private void VerMochila() { int actual = 0; int maxOpciones = prota.GetMochila().Count - 1; do { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("Mochila", 100, 50, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa <-- para volver atrás", 100, 100, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa ARRIBA o ABAJO para ", 100, 200, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("pasar objetos", 100, 250, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText((actual + 1) + "/" + prota.GetMochila().Count, 100, 300, 0xC0, 0xC0, 0xC0, font24); int i = 0; foreach (KeyValuePair <Objeto, int> kp in prota.GetMochila()) { if (i == actual) { SdlHardware.WriteHiddenText(kp.Key.Nombre + " x" + kp.Value, 100, 350, 0xC0, 0xC0, 0xC0, font24); } i++; } SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_DOWN)) { if (actual == maxOpciones) { actual = 0; } else { actual++; } } if (SdlHardware.KeyPressed(SdlHardware.KEY_UP)) { if (actual == 0) { actual = maxOpciones; } else { actual--; } } SdlHardware.Pause(100); } while (!SdlHardware.KeyPressed(Tao.Sdl.Sdl.SDLK_BACKSPACE)); }
public bool ShowItems() { int selected = 0; do { SdlHardware.Pause(100); List <string> drawItems = LoadDrawItems(); if (drawItems == null) { SdlHardware.WriteHiddenText("NO HAY OBJETOS", 552, 422, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText("NO HAY OBJETOS", 550, 420, 0xFF, 0xFF, 0xFF, Font28); } else { short posX = 840; short posY = 420; int index = selected - 6; index = index < 0 ? 0 : index; SdlHardware.DrawHiddenImage(items, 780, 400); for (int i = 0; i < 10 && i < drawItems.Count - 1; i++) { SdlHardware.WriteHiddenText(drawItems[index], (short)(posX + 2), (short)(posY + 2), 0x00, 0x00, 0x00, font16); SdlHardware.WriteHiddenText(drawItems[index], posX, posY, 0xFF, 0xFF, 0xFF, font16); posY += 30; index++; } int minSelected = selected - 10; minSelected = minSelected < 10 ? 0 : minSelected; int maxSelected = minSelected + 10; maxSelected = minSelected < 10 ? index - 1 : maxSelected; SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_W) && selected > minSelected) { selected--; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_S) && selected < maxSelected) { selected++; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_RETURN)) { Oneiric.g.Mcharacter.UseItem(drawItems[selected].Substring(0, 2)); return(true); } SdlHardware.DrawHiddenImage(selector2, 800, 418 + 30 * selected); SdlHardware.ShowHiddenScreen(); SdlHardware.Pause(100); } } while (!SdlHardware.KeyPressed(SdlHardware.KEY_ESC)); return(false); }
public void DrawMenu() { SdlHardware.DrawHiddenImage(Wallpaper, 0, 0); SdlHardware.DrawHiddenImage(menu, 650, 500); SdlHardware.DrawHiddenImage(historyI, 20, 425); SdlHardware.WriteHiddenText(texts["at"], 682, 522, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["at"], 680, 520, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["sk"], 682, 562, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["sk"], 680, 560, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["it"], 682, 602, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["it"], 680, 600, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["pt"], 682, 642, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["pt"], 680, 640, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["rn"], 682, 682, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["rn"], 680, 680, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.DrawHiddenImage(selector, 670, 522 + 40 * option); SdlHardware.WriteHiddenText(Convert.ToString( Oneiric.g.Mcharacter.ActualLife), 900, 250, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(Convert.ToString( Oneiric.g.Mcharacter.ActualLife), 900, 250, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(Convert.ToString( enemy.ActualLife), 200, 375, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(Convert.ToString( enemy.ActualLife), 200, 375, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.DrawHiddenImage(player, 900, 200); enemy.DrawOnHiddenScreen(); }
public override void DibujarInterfaz() { if (maxOpciones == 0) { SinPartidas(); } else { do { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(bg, 0, 0); SdlHardware.WriteHiddenText("Elige una partida", 100, 50, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa <-- para volver", 100, 100, 0xC0, 0xC0, 0xC0, font24); short altura = 200; foreach (string s in listaNombres) { if (s.Length > 0) { SdlHardware.WriteHiddenText(s, 100, altura, 0xC0, 0xC0, 0xC0, font24); altura += 100; } else { SinPartidas(); } } SdlHardware.WriteHiddenText("<--", 500, posicionFlecha, 0xC0, 0xC0, 0xC0, font24); SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_DOWN)) { if (seleccion == maxOpciones) { seleccion = 1; posicionFlecha = 200; } else { seleccion++; posicionFlecha += 100; } } if (SdlHardware.KeyPressed(SdlHardware.KEY_UP)) { if (seleccion == 1) { seleccion = maxOpciones; posicionFlecha = Convert.ToInt16(200 + (100 * (maxOpciones - 1))); } else { seleccion--; posicionFlecha -= 100; } } SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { partidaElegida = true; nombrePartida = listaNombres[seleccion - 1]; SdlHardware.Pause(100); } if (SdlHardware.KeyPressed(Tao.Sdl.Sdl.SDLK_BACKSPACE)) { SdlHardware.Pause(100); new MenuPartidas().Run(); } SdlHardware.Pause(40); } while (!partidaElegida); } }
private void AbrirMochila(ref bool accionRealizada) { int seleccionMochila = 0; int aux = 0; int maxOpcionesMochila = prota.GetMochila().Count - 1; int posicionFlechaMochila = 300; bool objetoElegido = false; Objeto objetoSeleccionado = null; do { SdlHardware.ClearScreen(); SdlHardware.DrawHiddenImage(new Image("data/menu_partidas.png"), 0, 0); if (prota.GetMochila().Count == 0) { SdlHardware.WriteHiddenText("Tu mochila está vacia", 100, 150, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa <-- para volver ", 100, 200, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("al combate", 100, 250, 0xC0, 0xC0, 0xC0, font24); } else { SdlHardware.WriteHiddenText("Pulsa Espacio para consumir un objeto", 80, 150, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("Pulsa <-- para volver al combate", 80, 200, 0xC0, 0xC0, 0xC0, font24); SdlHardware.WriteHiddenText("-->", 30, Convert.ToInt16(posicionFlechaMochila), 0xC0, 0xC0, 0xC0, font24); int altura = 300; foreach (KeyValuePair <Objeto, int> kp in prota.GetMochila()) { SdlHardware.WriteHiddenText(kp.Key.Nombre + " x" + kp.Value, 100, Convert.ToInt16(altura), 0xC0, 0xC0, 0xC0, font35); altura += 50; } altura = 300; if (SdlHardware.KeyPressed(SdlHardware.KEY_DOWN)) { if (seleccionMochila == maxOpcionesMochila) { seleccionMochila = 0; posicionFlechaMochila = 300; } else { seleccionMochila++; posicionFlechaMochila += 50; } } if (SdlHardware.KeyPressed(SdlHardware.KEY_UP)) { if (seleccionMochila == 0) { seleccionMochila = maxOpcionesMochila; posicionFlechaMochila = 300 + (maxOpcionesMochila * 50); } else { seleccionMochila--; posicionFlechaMochila -= 50; } } if (SdlHardware.KeyPressed(SdlHardware.KEY_SPC)) { objetoElegido = true; int i = 0; foreach (KeyValuePair <Objeto, int> kp in prota.GetMochila()) { if (i == seleccionMochila) { objetoSeleccionado = kp.Key; aux = kp.Value - 1; break; } i++; } SdlHardware.Pause(100); } } SdlHardware.ShowHiddenScreen(); SdlHardware.Pause(60); } while (!objetoElegido && !SdlHardware.KeyPressed(Tao.Sdl.Sdl.SDLK_BACKSPACE)); SdlHardware.Pause(100); if (objetoElegido) { prota.GetMochila().Remove(objetoSeleccionado); if (aux > 0) { prota.GetMochila().Add(objetoSeleccionado, aux); } do { DibujarInterfaz(); SdlHardware.WriteHiddenText(prota.GetNombre() + " usó " + objetoSeleccionado.Nombre, 100, 560, 0xC0, 0xC0, 0xC0, font35); SdlHardware.ShowHiddenScreen(); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_SPC)); SdlHardware.Pause(100); if (objetoSeleccionado.GetType().Name == "Pocion") { seleccionado.SetVida( seleccionado.GetVida() + ((Pocion)objetoSeleccionado).hpRecuperados <= seleccionado.GetMaxVida() ? seleccionado.GetVida() + ((Pocion)objetoSeleccionado).hpRecuperados : seleccionado.GetMaxVida()); } accionRealizada = true; } SdlHardware.Pause(100); }
public void ShowInventory() { int selected = 0; do { List <string> drawItems = LoadDrawItems(); if (drawItems == null) { SdlHardware.WriteHiddenText("NO HAY OBJETOS", 552, 422, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText("NO HAY OBJETOS", 550, 420, 0xFF, 0xFF, 0xFF, Font28); } else { short posX = 200; short posY = 230; int index = selected - 10; index = index < 0 ? 0 : index; SdlHardware.DrawHiddenImage(greyBackground, 0, 0); SdlHardware.DrawHiddenImage(selector, 160, 232 + 30 * selected); for (int i = 0; i < 10 && i < drawItems.Count - 1; i++) { SdlHardware.WriteHiddenText(drawItems[index], (short)(posX + 2), (short)(posY + 2), 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(drawItems[index], posX, posY, 0xFF, 0xFF, 0xFF, Font28); posY += 30; index++; } int minSelected = selected - 10; minSelected = minSelected < 10 ? 0 : minSelected; int maxSelected = minSelected + 10; maxSelected = minSelected < 10 ? index - 1 : maxSelected; SdlHardware.ShowHiddenScreen(); if (SdlHardware.KeyPressed(SdlHardware.KEY_W) && selected > minSelected) { selected--; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_S) && selected < maxSelected) { selected++; } else if (SdlHardware.KeyPressed(SdlHardware.KEY_RETURN)) { Oneiric.g.Mcharacter.UseItem(drawItems[selected].Substring(0, 2)); } SdlHardware.Pause(100); SdlHardware.ShowHiddenScreen(); } } while (!SdlHardware.KeyPressed(SdlHardware.KEY_ESC)); }
public void ShowParty() { SdlHardware.Pause(100); do { SdlHardware.DrawHiddenImage(greyBackground, 0, 0); SdlHardware.DrawHiddenImage(face, 620, 200); SdlHardware.DrawHiddenImage(icons[0], 212, 200); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.ActualLife.ToString() + " / " + Oneiric.g.Mcharacter.MaxiumLife.ToString(), 252, 202, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.ActualLife.ToString() + " / " + Oneiric.g.Mcharacter.MaxiumLife.ToString(), 250, 200, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.DrawHiddenImage(icons[1], 212, 250); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.ActualPm.ToString() + " / " + Oneiric.g.Mcharacter.MaxiumPm.ToString(), 252, 252, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.ActualPm.ToString() + " / " + Oneiric.g.Mcharacter.MaxiumPm.ToString(), 250, 250, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.DrawHiddenImage(icons[2], 212, 300); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.Damage.ToString(), 252, 302, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.Damage.ToString(), 250, 300, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.DrawHiddenImage(icons[3], 212, 350); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.Defense.ToString(), 252, 352, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.Defense.ToString(), 250, 350, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.DrawHiddenImage(icons[5], 212, 400); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.Speed.ToString(), 252, 402, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.Speed.ToString(), 250, 400, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.DrawHiddenImage(icons[6], 212, 450); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.Lucky.ToString(), 252, 452, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.Lucky.ToString(), 250, 450, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(Oneiric.g.Mcharacter.Speed.ToString(), 250, 400, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText("ESC -->", 602, 622, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText("ESC -->", 600, 620, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.ShowHiddenScreen(); SdlHardware.Pause(100); } while (!SdlHardware.KeyPressed(SdlHardware.KEY_ESC)); }
public void DrawMenu() { SdlHardware.DrawHiddenImage(Wallpaper, 0, 0); SdlHardware.WriteHiddenText(texts[SelectedOption()], 352, 132, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts[SelectedOption()], 350, 132, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["mn"], 962, 132, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["mn"], 960, 130, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["eq"], 922, 182, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["eq"], 920, 180, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["in"], 922, 252, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["in"], 920, 250, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["sn"], 922, 322, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["sn"], 920, 320, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["sv"], 922, 392, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["sv"], 920, 390, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["op"], 922, 462, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["op"], 920, 460, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["tt"], 922, 532, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["tt"], 920, 530, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.WriteHiddenText(texts["cl"], 922, 602, 0x00, 0x00, 0x00, Font28); SdlHardware.WriteHiddenText(texts["cl"], 920, 600, 0xFF, 0xFF, 0xFF, Font28); SdlHardware.DrawHiddenImage(selector, 890, 183 + 70 * option); }