public static void LocalMapDraw() { V.window.SetView(V.view); foreach (Chao x in V.chao.ToList()) { x.Draw(); } foreach (Limite x in V.limites.ToList()) { x.Draw(); } V.objetos.Sort((x, y) => x.zindex.CompareTo(y.zindex)); foreach (Geral x in V.objetos.ToList()) { x.Draw(); } V.window.SetView(V.hud); foreach (TempText x in V.temptexts.ToList()) { x.Draw(); } Efeitos.BackdropRun(); }
public static void TelaPrincipal() { V.img[0].TextureRect = new IntRect(0, 0, 502, 476); V.img[0].Texture = logo; V.img[0].Position = new Vector2f(Screen.width / 2 - 251, Screen.height / 2 - 238); V.window.Draw(V.img[0]); if (Efeitos.opacidade <= 0 && !F.TeclaDesativada("delay") && !delay) { delay = true; F.DesativarTecla("delay", 750); } if (Efeitos.opacidade <= 0 && !F.TeclaDesativada("delay") && delay) { Efeitos.Backdrop("fade-in", 255, 1.25f); } if (Efeitos.opacidade >= 255 && delay) { CurrentScreen.Change("mainmenu"); } if (F.Key("x")) { Efeitos.opacidade = 255; CurrentScreen.Change("mainmenu"); F.DesativarTecla("x", 500); } F.TeclasDesativadasF(); Efeitos.BackdropRun(); }
public static void DrawHUD() { V.window.SetView(V.hud); if (V.backdrop) { Efeitos.BackdropRun(); } }
public static void TelaPrincipal() { V.window.SetView(V.view); foreach (Chao x in V.chao.ToList()) { x.Draw(); } foreach (Limite x in V.limites.ToList()) { x.Draw(); } foreach (Teleporte x in V.teleportes.ToList()) { x.Draw(); } V.objetos.Sort((x, y) => x.zindex.CompareTo(y.zindex)); foreach (Geral x in V.objetos.ToList()) { x.Draw(); } V.window.SetView(V.hud); Configuracoes.Draw(); Efeitos.BackdropRun(); if (menu) { F.Menu(); } foreach (IC x in V.interacaoContinua.ToList()) { x.x1.Interagir(1); } foreach (TempText x in V.temptexts.ToList()) { x.Draw(); } foreach (PopUp x in V.popups.ToList()) { x.Draw(); } }
public static int TelaPrincipal(){ string[] opcoesMenu = {"Jogar", "Configurações", "Criar Mapa", "Créditos", "Sair"}; F.DesenharShape(0, 0, Screen.width, Screen.height, 19, 19, 19, 255); F.Escrever("Cybership", true, Screen.width-F.TxtWidth("Cybership", 50, true)-30, 20, 50, 255, 255, 255, 255); for(int m=0;m<opcoesMenu.Count();m++) F.Escrever(opcoesMenu[m], false, Screen.width-F.TxtWidth(opcoesMenu[m], 32, false)-30, Screen.height/2-40+40*m, 32, 255, 255, 255, 255); F.Escrever("v0.5.2 Alpha", false, Screen.width-F.TxtWidth("v0.5.2 Alpha", 32, false)-30, Screen.height-50, 32, 255, 255, 255, 255); if(!F.TeclaDesativada("frameMainMenu")){ frame += frame > 6 ? -frame : 1; F.DesativarTecla("frameMainMenu", 300); } V.img[0].Texture = V.IMG_CAT[8][0]; V.img[0].TextureRect = new IntRect(0, 0, 27, 15); V.img[0].Position = new Vector2f(Screen.width-F.TxtWidth(opcoesMenu[option], 32, false)-67, (Screen.height/2)-25+(40*option)); V.window.Draw(V.img[0]); V.img[0].Texture = V.IMG_CAT[0][0]; V.img[0].Position = new Vector2f(30, Screen.height-294); V.img[0].TextureRect = new IntRect(96*frame, 0, 96, 136); V.img[0].Scale = new Vector2f(1.5f, 1.5f); V.window.Draw(V.img[0]); V.img[0].Scale = new Vector2f(1, 1); if((F.Key("down") && !F.TeclaDesativada("option")) && option < opcoesMenu.Length-1){ option++; F.DesativarTecla("option", 175); } else if((F.Key("up") && !F.TeclaDesativada("option")) && option > 0){ option--; F.DesativarTecla("option", 175); } else if(F.Key("x") && !F.TeclaDesativada("x")){ F.DesativarTecla("x", 175); F.DesativarTecla("mouseLeft", 175); return option; } Efeitos.BackdropRun(); return -1; }
public static void Fim() { V.window.SetView(V.hud); Efeitos.BackdropRun(); switch (transition_state) { case 0: F.DesativarTecla("transition_state", 1500); V.bullets.Clear(); V.backdrop = false; fim = DateTime.Now; transition_state++; break; case 1: if (!F.TeclaDesativada("transition_state")) { if (!V.multiplayer) { if (player1.y + player1.height > 0 || player1.x + player1.width / 2 != Screen.width / 2) { player1.y -= (player1.y + player1.height > 0 ? (player1.x + player1.width / 2 == Screen.width / 2 ? player1.speed * 2 : player1.speed / 2) : 0); player1.x += (player1.x + player1.width / 2 == Screen.width / 2 ? 0 : (player1.x + player1.width / 2 > Screen.width / 2 ? -player1.speed / 2 : player1.speed / 2)); if (Math.Abs(player1.x + player1.width / 2 - Screen.width / 2) < 5) { player1.x = Screen.width / 2 - player1.width / 2; } break; } } else if (player1.y + player1.height > 0 || player2.y + player2.height > 0 || player1.x + player1.width / 2 != Screen.width * 0.25f || player2.x + player2.width / 2 != Screen.width * 0.75f) { player1.y -= (player1.y + player1.height > 0 ? (player1.x + player1.width / 2 == Screen.width * 0.25f ? player1.speed * 2 : player1.speed / 2) : 0); player1.x += (player1.x + player1.width / 2 == Screen.width * 0.25f ? 0 : (player1.x + player1.width / 2 > Screen.width * 0.25f ? -player1.speed / 2 : player1.speed / 2)); player2.y -= (player2.y + player2.height > 0 ? (player2.x + player2.width / 2 == Screen.width * 0.75f ? player2.speed * 2 : player2.speed / 2) : 0); player2.x += (player2.x + player2.width / 2 == Screen.width * 0.75f ? 0 : (player2.x + player2.width / 2 > Screen.width * 0.75f ? -player2.speed / 2 : player2.speed / 2)); if (Math.Abs(player1.x + player1.width / 2 - Screen.width * 0.25f) < 5) { player1.x = Screen.width * 0.25f - player1.width / 2; } if (Math.Abs(player2.x + player2.width / 2 - Screen.width * 0.75f) < 5) { player2.x = Screen.width * 0.75f - player2.width / 2; } break; } F.DesativarTecla("transition_state", 750); transition_state++; } break; case 2: if (!F.TeclaDesativada("transition_state")) { Efeitos.Backdrop("fade-in", 255, 5f); transition_state++; } break; case 3: if (Efeitos.opacidade == 255) { F.Escrever("Congratulations!", true, (Screen.width / 2) - (F.TxtWidth("Congratulations!", 60, true) / 2), (Screen.height / 2) - 200, 60, 255, 255, 255, (byte)txt_op, 000, 000, 47, 255, 1); F.Escrever("You have finished the game!", false, (Screen.width / 2) - (F.TxtWidth("You have finished the game!!", 32, false) / 2), (Screen.height / 2) - 140, 32, 255, 255, 255, (byte)txt_op, 000, 000, 47, 255, 1); txt_op += 2.5f; } if (txt_op == 255) { txt_op = 0; transition_state++; } break; case 4: if (!F.TeclaDesativada("a") && (F.Key("a") || F.Key("d")) && txt_op >= 255) { gameover_option = !gameover_option; F.DesativarTecla("a", 250); } if (F.Key("space") && txt_op >= 255) { if (gameover_option) { level++; player1.x = V.multiplayer ? Screen.width * 0.25f : (Screen.width / 2) - 32; player1.y = Screen.height + 46; if (V.multiplayer) { player2.x = Screen.width * 0.75f; player2.y = Screen.height + 46; } ResetVars(false); F.DesativarTecla("space", 300); } else { CurrentScreen.Change("mainmenu"); } F.DesativarTecla("space", 300); } else { F.Escrever("Congratulations!", true, (Screen.width / 2) - (F.TxtWidth("Congratulations!", 60, true) / 2), (Screen.height / 2) - 200, 60, 255, 255, 255, (byte)255, 000, 000, 47, 255, 1); F.Escrever("You have finished the game!", false, (Screen.width / 2) - (F.TxtWidth("You have finished the game!!", 32, false) / 2), (Screen.height / 2) - 140, 32, 255, 255, 255, (byte)255, 000, 000, 47, 255, 1); F.Escrever("Level........................................... " + level, false, (Screen.width / 4), (Screen.height / 2) - 90, 36, 255, 255, 255, (byte)txt_op); F.Escrever("Score.......................................... " + score, false, (Screen.width / 4), (Screen.height / 2) - 55, 36, 255, 255, 255, (byte)txt_op); F.Escrever("Enemies Killed........................... " + enemies_killed, false, (Screen.width / 4), (Screen.height / 2) - 20, 36, 255, 255, 255, (byte)txt_op); F.Escrever("Time Alive................................... " + String.Format("{0}:{1}", (fim - inicio).Minutes, (fim - inicio).Seconds), false, (Screen.width / 4), (Screen.height / 2) + 15, 36, 255, 255, 255, (byte)txt_op); if (gameover_option) { F.DesenharShape((Screen.width / 2) - (F.TxtWidth("Main Menu", 26, true)) - 6, (Screen.height / 2) + 103, F.TxtWidth("Continue", 26, true) + 12, 30, 255, 255, 255, (byte)txt_op); F.Escrever("Continue", true, (Screen.width / 2) - F.TxtWidth("Continue", 26, true) - 20, (Screen.height / 2) + 100, 26, 000, 000, 000, (byte)txt_op); F.Escrever("Main Menu", true, (Screen.width / 2) + 10, (Screen.height / 2) + 100, 26, 255, 255, 255, (byte)txt_op); } else { F.DesenharShape((Screen.width / 2) + 4, (Screen.height / 2) + 103, F.TxtWidth("Main Menu", 26, true) + 12, 30, 255, 255, 255, (byte)txt_op); F.Escrever("Main Menu", true, (Screen.width / 2) + 10, (Screen.height / 2) + 100, 26, 000, 000, 000, (byte)txt_op); F.Escrever("Continue", true, (Screen.width / 2) - F.TxtWidth("Continue", 26, true) - 20, (Screen.height / 2) + 100, 26, 255, 255, 255, (byte)txt_op); } txt_op += txt_op >= 255 ? 0 : 5; } break; } }
public static void GameOver() { V.window.SetView(V.hud); Efeitos.BackdropRun(); switch (transition_state) { case 0: V.bullets.Clear(); V.backdrop = false; fim = DateTime.Now; F.DesativarTecla("transition_state", 750); transition_state++; break; case 1: if (!F.TeclaDesativada("transition_state")) { Efeitos.Backdrop("fade-in", 255, 2.5f); transition_state++; } break; case 2: if (Efeitos.opacidade == 255) { F.Escrever("Game Over", true, (Screen.width / 2) - (F.TxtWidth("Game Over", 60, true) / 2), (Screen.height / 2) - 200, 60, 255, 255, 255, (byte)txt_op, 000, 000, 47, 255, 1); txt_op += 2.5f; } if (txt_op == 255) { txt_op = 0; transition_state++; } break; case 3: if (!F.TeclaDesativada("a") && (F.Key("a") || F.Key("d")) && txt_op >= 255) { gameover_option = !gameover_option; F.DesativarTecla("a", 250); } if (F.Key("space") && txt_op >= 255) { if (gameover_option) { ResetGame(); } else { CurrentScreen.Change("mainmenu"); } F.DesativarTecla("space", 300); } else { F.Escrever("Game Over", true, (Screen.width / 2) - (F.TxtWidth("Game Over", 60, true) / 2), (Screen.height / 2) - 200, 60, 255, 255, 255, 255); F.Escrever("Level........................................... " + level, false, (Screen.width / 4), (Screen.height / 2) - 100, 36, 255, 255, 255, (byte)txt_op); F.Escrever("Score.......................................... " + score, false, (Screen.width / 4), (Screen.height / 2) - 65, 36, 255, 255, 255, (byte)txt_op); F.Escrever("Enemies Killed........................... " + enemies_killed, false, (Screen.width / 4), (Screen.height / 2) - 30, 36, 255, 255, 255, (byte)txt_op); F.Escrever("Time Alive................................... " + String.Format("{0}:{1}", (fim - inicio).Minutes, (fim - inicio).Seconds), false, (Screen.width / 4), (Screen.height / 2) + 5, 36, 255, 255, 255, (byte)txt_op); if (gameover_option) { F.DesenharShape((Screen.width / 2) - (F.TxtWidth("Main Menu", 26, true)) - 6, (Screen.height / 2) + 103, F.TxtWidth("Restart", 26, true) + 12, 30, 255, 255, 255, (byte)txt_op); F.Escrever("Restart", true, (Screen.width / 2) - F.TxtWidth("Restart", 26, true) - 30, (Screen.height / 2) + 100, 26, 000, 000, 000, (byte)txt_op); F.Escrever("Main Menu", true, (Screen.width / 2) + 10, (Screen.height / 2) + 100, 26, 255, 255, 255, (byte)txt_op); } else { F.DesenharShape((Screen.width / 2) + 4, (Screen.height / 2) + 103, F.TxtWidth("Main Menu", 26, true) + 12, 30, 255, 255, 255, (byte)txt_op); F.Escrever("Main Menu", true, (Screen.width / 2) + 10, (Screen.height / 2) + 100, 26, 000, 000, 000, (byte)txt_op); F.Escrever("Restart", true, (Screen.width / 2) - F.TxtWidth("Restart", 26, true) - 30, (Screen.height / 2) + 100, 26, 255, 255, 255, (byte)txt_op); } txt_op += txt_op >= 255 ? 0 : 5; } break; } }
public static void Menu() { if (F.Key("esc") && menu && !F.TeclaDesativada("esc")) { V.backdrop = true; menu = false; state = 0; state_ = 2; F.AtivarTecla("bullet"); F.DesativarTecla("bullet", 500); F.DesativarTecla("esc", 300); Efeitos.Backdrop("fade-out", 0, 25); } V.window.SetView(V.hud); Efeitos.BackdropRun(); string[] e = new string[2]; e[0] = "Continuar"; e[1] = "Menu Principal"; if ((F.Key("up") || F.Key("w")) && sY > 0 && !F.TeclaDesativada("up")) { sY--; F.DesativarTecla("up", 125); } if ((F.Key("down") || F.Key("s")) && sY < 1 && !F.TeclaDesativada("down")) { sY++; F.DesativarTecla("down", 125); } for (int m = 0; m < 2; m++) { cA = (m == mA && mY == -1) ? (byte)35 : (byte)19; if (sY == m) { cX = 35; cY = 255; if (F.Key("space")) { switch (m) { case 0: state = 0; state_ = 2; break; case 1: state = 2; CurrentScreen.Change("mainmenu"); break; } menu = false; F.DesativarTecla("esc", 300); F.DesativarTecla("space", 300); Efeitos.Backdrop("fade-out", 0, 25); } } else { cX = 19; cY = 130; } F.DesenharShape(((Screen.width - 240) / 2), (Screen.height / 2) + (80 * m) - 80, 240, 80, cX, cX, cX, 255); F.Escrever(e[m], true, ((Screen.width - 240) / 2) + 120 - (F.TxtWidth(e[m], 32, true) / 2), (Screen.height / 2) + 16 + (80 * m) - 80, 32, cY, cY, cY, 230); } }