public static void Fim() { if (x1[0].movimentar <= 0 && x1[0].vida > 0) { CurrentScreen.Change("localmap"); } else if (x1[0].vidaA <= 0) { x1[0].OnDie(); } }
static void Main() { V.window.SetMouseCursorVisible(false); V.window.Closed += new EventHandler(OnClose); V.window.Resized += new EventHandler <SizeEventArgs>(OnResize); V.window.MouseMoved += new EventHandler <MouseMoveEventArgs>(OnMouseMoved); V.window.MouseButtonPressed += new EventHandler <MouseButtonEventArgs>(OnMouseClicked); V.window.MouseButtonReleased += new EventHandler <MouseButtonEventArgs>(OnMouseReleased); V.window.MouseWheelScrolled += new EventHandler <MouseWheelScrollEventArgs>(OnMouseWheel); V.window.TextEntered += new EventHandler <TextEventArgs>(OnTextEntered); V.window.KeyPressed += new EventHandler <SFML.Window.KeyEventArgs>(OnKeyPressed); V.ImgLoad(); windowColor = new Color(255, 255, 255); CurrentScreen.Add("login", new LoginState()); CurrentScreen.Add("intro", new IntroState()); CurrentScreen.Add("mainmenu", new MainMenuState()); CurrentScreen.Add("loadfile", new LoadFileState()); CurrentScreen.Add("config", new ConfigState()); CurrentScreen.Add("controles", new ControlesState()); CurrentScreen.Add("joystick", new JoystickState()); CurrentScreen.Add("createmap", new CreateMapState()); CurrentScreen.Add("localmap", new LocalMapState()); CurrentScreen.Add("worldmap", new WorldMapState()); CurrentScreen.Add("battle", new BattleState()); CurrentScreen.Add("video", new VideoState()); CurrentScreen.Add("fimdemo", new FimDemoState()); CurrentScreen.Set("intro"); Image image = new Image("res/icon.png"); V.window.SetIcon(image.Size.X, image.Size.Y, image.Pixels); while (V.window.IsOpen) { V.window.DispatchEvents(); V.window.Clear(windowColor); try{ Draw(); CurrentScreen.Draw(); DrawHUD(); } catch (Exception e) { Console.WriteLine(e); } V.window.Display(); } }
public static void TelaPrincipal() { int sw = (int)(Screen.width / 128) + 1; int sh = (int)(Screen.height / 128) + 1; for (int x = 0; x < sw; x++) { for (int y = 0; y < sh; y++) { V.img[0].TextureRect = new IntRect(0, 0, 128, 128); V.img[0].Texture = V.IMG_CAT[11][spriteMar]; V.img[0].Position = new Vector2f(128 * x, 128 * y); V.window.Draw(V.img[0]); } } V.img[0].TextureRect = new IntRect(0, 0, 702, 738); V.img[0].Texture = V.IMG_CAT[12][spriteMapa]; V.img[0].Position = new Vector2f((int)(Screen.width / 2) - 351, (int)(Screen.height / 2) - 369); V.window.Draw(V.img[0]); int arrowY = arrow ? 0 : -10; V.img[0].TextureRect = new IntRect(0, 0, 18, 27); V.img[0].Texture = V.IMG_CAT[8][6]; V.img[0].Position = new Vector2f((int)(Screen.width / 2) - 351 + 138, (int)(Screen.height / 2) - 369 + 353 + arrowY); V.window.Draw(V.img[0]); if (firstFrame) { F.DesativarTecla("worldmap_mar", 300); firstFrame = false; } if (!F.TeclaDesativada("worldmap_mar")) { spriteMar = (spriteMar > 4) ? 0 : spriteMar + 1; F.DesativarTecla("worldmap_mar", 300); } if (!F.TeclaDesativada("worldmap_arrow")) { arrow = !arrow; F.DesativarTecla("worldmap_arrow", 500); } if ((F.Key("esc") || F.Key("c")) && !F.TeclaDesativada("esc")) { CurrentScreen.Change("localmap"); F.DesativarTecla("esc", 200); } }
public static void ChangeState(int opcao) { switch (opcao) { case 2: CurrentScreen.Change("controles"); break; case 3: if (!JoystickState.connected) { CurrentScreen.Change("joystick"); } break; } }
public static void TelaPrincipal() { if ((F.Key("esc") || F.Key("c")) && !F.TeclaDesativada("voltar") && !F.TeclaDesativada("change") && !changing) { CurrentScreen.Change("config"); F.DesativarTecla("voltar", 200); } F.DesenharShape(0, 0, Screen.width, Screen.height, 19, 19, 19, 255); F.Escrever("Configurar Controles", true, Screen.width - F.TxtWidth("Configurar Controles", 50, true) - 30, 20, 50, 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); int m = 0; foreach (Controle c in V.controles) { string s = (changing && m == option) ? "-" : ((Keyboard.Key)c.keycode).ToString(); F.Escrever(c.nome, false, 315, 120 + 40 * m, 32, 255, 255, 255, 255); F.Escrever(s, false, Screen.width - F.TxtWidth(s, 32, false) - 30, 120 + 40 * m, 32, 255, 255, 255, 255); m++; } 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(280, 135 + (40 * option)); V.window.Draw(V.img[0]); if (F.Key("up") && !F.TeclaDesativada("option") && option > 0 && !changing && !F.TeclaDesativada("change")) { option--; F.DesativarTecla("option", 175); } else if ((F.Key("down") && !F.TeclaDesativada("option")) && option < V.controles.Count() - 1 && !changing && !F.TeclaDesativada("change")) { option++; F.DesativarTecla("option", 175); } else if (F.Key("x") && !F.TeclaDesativada("x") && !F.TeclaDesativada("change")) { changing = true; F.DesativarTecla("x", 175); } }
public static void TelaPrincipal() { if ((F.Key("esc") || F.Key("c")) && !connected && !F.TeclaDesativada("voltar")) { thread.Abort(); Joystick.Stop(); F.DesativarTecla("voltar", 200); CurrentScreen.Change("config"); } F.DesenharShape(0, 0, Screen.width, Screen.height, 19, 19, 19, 255); F.Escrever("Conectar Joystick", true, Screen.width - F.TxtWidth("Conectar Joystick", 50, true) - 30, 20, 50, 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); F.DesenharShape(Screen.width / 2 - 130, Screen.height / 2 - 130, 260, 260, 255, 255, 255, 255); V.img[1].Texture = t; V.img[1].Position = new Vector2f(Screen.width / 2 - 120, Screen.height / 2 - 120); V.window.Draw(V.img[1]); if (!connected) { F.Escrever("Aguardando...", false, Screen.width / 2 - (F.TxtWidth("Aguardando...", 32, false) / 2), Screen.height / 2 + 140, 32, 255, 255, 255, 255); } else { F.Escrever("Controle Conectado!", false, Screen.width / 2 - (F.TxtWidth("Controle Conectado!", 32, false) / 2), Screen.height / 2 + 140, 32, 000, 255, 000, 255); } if (!delay && connected) { F.DesativarTecla("delayControle", 1500); delay = true; } if (!F.TeclaDesativada("delayControle") && connected && delay) { CurrentScreen.Change("config"); } }
static void Main() { V.window.SetMouseCursorVisible(false); V.window.Closed += new EventHandler(OnClose); V.window.Resized += new EventHandler <SizeEventArgs>(OnResize); V.ImgLoad(); windowColor = new Color(255, 255, 255); CurrentScreen.Add("intro", new IntroState()); CurrentScreen.Add("mainmenu", new MainMenuState()); CurrentScreen.Add("instrucoes", new InstrucoesState()); CurrentScreen.Add("credits", new CreditsState()); CurrentScreen.Add("play", new PlayState()); CurrentScreen.Set("intro"); Image image = new Image("res/icon.png"); V.window.SetIcon(image.Size.X, image.Size.Y, image.Pixels); V.window.SetFramerateLimit((uint)120); while (V.window.IsOpen) { V.window.DispatchEvents(); V.window.Clear(windowColor); try{ Draw(); CurrentScreen.Draw(); DrawHUD(); } catch (Exception e) { Console.WriteLine(e); } V.window.Display(); } }
public static void Menu() { x = Configuracoes.controle; for (int m = 0; m < 3; m++) { for (int n = 0; n < 3; n++) { menuArray[m, n] = -1; } } if (F.Key("esc") && !x.menu && !x.pausado && !F.TeclaDesativada("esc")) { x.menu = true; x.menuType = 0; F.DesativarTecla("esc", 300); Efeitos.Backdrop("fade-in", 125, 25); } else if (F.Key("esc") && x.menu && !F.TeclaDesativada("esc")) { x.menu = false; F.DesativarTecla("esc", 300); F.BloquearMov(x, false); Efeitos.Backdrop("fade-out", 0, 25); } if (F.Key("enter") && !x.menu && !x.pausado && !F.TeclaDesativada("enter")) { x.menu = true; x.menuType = 1; F.DesativarTecla("enter", 300); Efeitos.Backdrop("fade-in", 125, 25); } else if (F.Key("enter") && x.menu && !F.TeclaDesativada("enter")) { x.menu = false; F.DesativarTecla("enter", 300); F.BloquearMov(x, false); Efeitos.Backdrop("fade-out", 0, 25); } if (x.menu && x.menuType == 0) { V.window.SetView(V.hud); F.BloquearMov(x, true); string[] e = new string[3]; e[0] = "Continuar"; e[1] = "Mapa"; e[2] = "Menu Principal"; if (F.Key("up") && sY > 0 && !F.TeclaDesativada("up") && !F.MouseIn(((Screen.width - 240) / 2), ((Screen.height - 400) / 2), 240, 240)) { sY--; F.DesativarTecla("up", 125); } if (F.Key("down") && sY < 2 && !F.TeclaDesativada("down") && !F.MouseIn(((Screen.width - 240) / 2), ((Screen.height - 400) / 2), 240, 240)) { sY++; F.DesativarTecla("down", 125); } for (int m = 0; m < 3; m++) { cA = (m == mA && mY == -1) ? (byte)35 : (byte)19; if (sY == m) { cX = 35; cY = 255; if (F.Key("x")) { switch (m) { case 0: x.menu = false; F.BloquearMov(x, false); F.DesativarTecla("esc", 300); F.DesativarTecla("x", 300); Efeitos.Backdrop("fade-out", 0, 25); break; case 1: CurrentScreen.Change("worldmap"); break; case 2: Idk.DeletarMapa(); CurrentScreen.Change("mainmenu"); x.menu = false; F.BloquearMov(x, false); F.DesativarTecla("esc", 300); F.DesativarTecla("x", 300); Efeitos.Backdrop("fade-out", 0, 25); break; } } } else { cX = 19; cY = 130; } F.DesenharShape(((Screen.width - 240) / 2), ((Screen.height - 400) / 2) + 80 * m, 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 - 400) / 2) + 16 + (80 * m), 32, cY, cY, cY, 230); } } if (x.menu && x.menuType == 1) { F.BloquearMov(x, true); F.DesenharShape(((Screen.width - 720) / 2), ((Screen.height - 400) / 2), 720, 400, 210, 210, 210, 230); string[] e = new string[3]; e[0] = "Itens"; e[1] = "Recursos"; e[2] = "Habilidades"; for (int m = 0; m < 3; m++) { cA = (m == mA && mY == -1) ? (byte)35 : (byte)19; F.DesenharShape(((Screen.width - 720) / 2) + (240 * m), ((Screen.height - 400) / 2), 240, 80, cA, cA, cA, 255); cA = (m == mA) ? (byte)255 : (byte)130; F.Escrever(e[m], true, ((Screen.width - 720) / 2) + 120 - (F.TxtWidth(e[m], 32, true) / 2) + (240 * m), ((Screen.height - 400) / 2) + 16, 32, cA, cA, cA, 230); } if (mY == -1) { mX = 0; } if (mA < 2) { for (int m = 0; m < 3; m++) { for (int n = 0; n < 3; n++) { cA = (m == mY && n == mX) ? (byte)35 : (byte)19; F.DesenharShape(((Screen.width - 720) / 2) + 20 + (100 * n), ((Screen.height - 400) / 2) + 100 + (100 * m), 80, 80, cA, cA, cA, 255); if (mA == 0 && x.itens.Count > (m * 3) + n) { menuArray[m, n] = V.itens.IndexOf(x.itens[(m * 3) + n]); V.img[1].Texture = V.IMG_CAT[5][x.itens[(m * 3) + n].sprite]; V.img[1].Scale = new Vector2f((float)80 / V.IMG_CAT[5][x.itens[(m * 3) + n].sprite].Size.X, (float)80 / V.IMG_CAT[5][x.itens[(m * 3) + n].sprite].Size.Y); V.img[1].Position = new Vector2f(((Screen.width - 720) / 2) + 20 + (100 * n), ((Screen.height - 400) / 2) + 100 + (100 * m)); V.img[1].TextureRect = new IntRect(0, 0, (int)V.IMG_CAT[5][x.itens[(m * 3) + n].sprite].Size.X, (int)V.IMG_CAT[5][x.itens[(m * 3) + n].sprite].Size.Y); V.window.Draw(V.img[1]); F.Escrever("" + x.itens[(m * 3) + n].quantidade, true, ((Screen.width - 720) / 2) + 96 + (100 * n) - F.TxtWidth("" + x.itens[(m * 3) + n].quantidade, 20, true), ((Screen.height - 400) / 2) + 156 + (100 * m), 18, 255, 255, 255, 255, 000, 000, 000, 255, 2); } if (mA == 1 && x.recursos.Count > (m * 3) + n) { menuArray[m, n] = (m * 3) + n; V.img[1].Texture = V.IMG_CAT[6][x.recursos[menuArray[m, n]].sprite]; V.img[1].Scale = new Vector2f((float)80 / V.IMG_CAT[6][x.recursos[menuArray[m, n]].sprite].Size.X, (float)80 / V.IMG_CAT[6][x.recursos[menuArray[m, n]].sprite].Size.Y); V.img[1].Position = new Vector2f(((Screen.width - 720) / 2) + 20 + (100 * n), ((Screen.height - 400) / 2) + 100 + (100 * m)); V.img[1].TextureRect = new IntRect(0, 0, (int)V.IMG_CAT[6][x.recursos[menuArray[m, n]].sprite].Size.X, (int)V.IMG_CAT[6][x.recursos[menuArray[m, n]].sprite].Size.Y); V.window.Draw(V.img[1]); F.Escrever("" + x.recursos[menuArray[m, n]].quantidade, true, ((Screen.width - 720) / 2) + 96 + (100 * n) - F.TxtWidth("" + x.recursos[menuArray[m, n]].quantidade, 20, true), ((Screen.height - 400) / 2) + 156 + (100 * m), 18, 255, 255, 255, 255, 000, 000, 000, 255, 2); } rN++; } } F.DesenharShape(((Screen.width - 720) / 2) + 320, ((Screen.height - 400) / 2) + 100, 380, 280, 000, 000, 000, 230); if (mA == 0 && mY > -1 && menuArray[mY, mX] != -1) { V.img[1].Texture = V.IMG_CAT[5][x.itens[(mY * 3) + mX].sprite]; V.img[1].Scale = new Vector2f((float)80 / V.IMG_CAT[5][x.itens[(mY * 3) + mX].sprite].Size.X, (float)80 / V.IMG_CAT[5][x.itens[(mY * 3) + mX].sprite].Size.Y); V.img[1].Position = new Vector2f(((Screen.width - 720) / 2) + 320, ((Screen.height - 400) / 2) + 100); V.img[1].TextureRect = new IntRect(0, 0, (int)V.IMG_CAT[5][x.itens[(mY * 3) + mX].sprite].Size.X, (int)V.IMG_CAT[5][x.itens[(mY * 3) + mX].sprite].Size.Y); V.window.Draw(V.img[1]); F.Escrever(V.itens[menuArray[mY, mX]].nome, true, ((Screen.width - 720) / 2) + 420, ((Screen.height - 400) / 2) + 95, 42, 255, 255, 255, 230); F.Escrever(V.itens[menuArray[mY, mX]].descricao, true, ((Screen.width - 720) / 2) + 335, ((Screen.height - 400) / 2) + 185, 28, 255, 255, 255, 230); if (F.Key("x") && !F.TeclaDesativada("x") && !F.TeclaDesativada("enter")) { x.item = V.itens[menuArray[mY, mX]]; x.menu = false; F.DesativarTecla("enter", 300); F.DesativarTecla("x", 300); F.BloquearMov(x, false); Efeitos.Backdrop("fade-out", 0, 25); } } else if (mA == 1 && mY > -1 && menuArray[mY, mX] != -1) { V.img[1].Texture = V.IMG_CAT[6][x.recursos[menuArray[mY, mX]].sprite]; V.img[1].Scale = new Vector2f((float)80 / V.IMG_CAT[6][x.recursos[menuArray[mY, mX]].sprite].Size.X, (float)80 / V.IMG_CAT[6][x.recursos[menuArray[mY, mX]].sprite].Size.Y); V.img[1].Position = new Vector2f(((Screen.width - 720) / 2) + 320, ((Screen.height - 400) / 2) + 100); V.img[1].TextureRect = new IntRect(0, 0, (int)V.IMG_CAT[6][x.recursos[menuArray[mY, mX]].sprite].Size.X, (int)V.IMG_CAT[6][x.recursos[menuArray[mY, mX]].sprite].Size.Y); V.window.Draw(V.img[1]); F.Escrever(x.recursos[menuArray[mY, mX]].nome, true, ((Screen.width - 720) / 2) + 420, ((Screen.height - 400) / 2) + 95, 42, 255, 255, 255, 230); F.Escrever(x.recursos[menuArray[mY, mX]].descricao, true, ((Screen.width - 720) / 2) + 335, ((Screen.height - 400) / 2) + 185, 28, 255, 255, 255, 230); F.Escrever("Quantidade: " + x.recursos[menuArray[mY, mX]].quantidade, true, ((Screen.width - 720) / 2) + 685 - F.TxtWidth("Quantidade: " + x.recursos[menuArray[mY, mX]].quantidade, 28, true), ((Screen.height - 400) / 2) + 335, 28, 255, 255, 255, 230); } if (F.Key("c") && !F.TeclaDesativada("c") && !F.TeclaDesativada("enter")) { x.item = null; x.menu = false; F.DesativarTecla("enter", 300); F.DesativarTecla("c", 300); F.BloquearMov(x, false); Efeitos.Backdrop("fade-out", 0, 25); } if (F.Key("right") && !F.TeclaDesativada("menuMove")) { if (mY == -1 && mA < 2) { mA++; } else if (mY > -1 && mX < 2) { mX++; } F.DesativarTecla("menuMove", 175); } else if (F.Key("left") && !F.TeclaDesativada("menuMove")) { if (mY == -1 && mA > 0) { mA--; } else if (mY > -1 && mX > 0) { mX--; } F.DesativarTecla("menuMove", 175); } else if (F.Key("up") && !F.TeclaDesativada("menuMove") && mY > -1) { mY--; F.DesativarTecla("menuMove", 175); } else if (F.Key("down") && !F.TeclaDesativada("menuMove") && mY < 2) { mY++; F.DesativarTecla("menuMove", 175); } } else { int m; if (mX > 1) { mX = 1; } if (mX == 0) { hY = 0; } for (m = 0; m < 3; m++) { cA = (mX == 0 && m == mY) ? (byte)35 : (byte)19; F.DesenharShape(((Screen.width - 720) / 2) + 20, ((Screen.height - 400) / 2) + 100 + (100 * m), 80, 80, cA, cA, cA, 255); byte c = (mY == m) ? (byte)255 : (byte)135; F.Escrever("" + (m + 1), true, ((Screen.width - 720) / 2) + 60 - (F.TxtWidth("" + (m + 1), 34, true) / 2), ((Screen.height - 400) / 2) + 113.5f + (100 * m), 34, c, c, c, 255); } F.DesenharShape(((Screen.width - 720) / 2) + 220, ((Screen.height - 400) / 2) + 100, 480, 280, 000, 000, 000, 230); if (mY > -1) { F.Escrever(Configuracoes.controle.skills[mY].Nome(), true, ((Screen.width - 720) / 2) + 265, ((Screen.height - 400) / 2) + 105, 34, 255, 255, 255, 255); for (m = 3; m < Configuracoes.controle.skills.Count(); m++) { byte c = (Configuracoes.controle.skills[m] == Configuracoes.controle.skills[mY]) ? (byte)255 : (byte)135; F.Escrever(Configuracoes.controle.skills[m].Nome(), true, ((Screen.width - 720) / 2) + 265, ((Screen.height - 400) / 2) + 105 + (45 * (m - 2)), 34, c, c, c, 255); } if (mX == 1) { 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 - 720) / 2) + 230, ((Screen.height - 400) / 2) + 120 + (45 * hY)); V.window.Draw(V.img[0]); } } if (F.Key("x") && !F.TeclaDesativada("x")) { if (mX == 1 && hY > 0) { Skill tmp = Configuracoes.controle.skills[mY]; Configuracoes.controle.skills[mY] = Configuracoes.controle.skills[hY + 2]; Configuracoes.controle.skills[hY + 2] = tmp; } mX = mX == 0 ? 1 : 0; F.DesativarTecla("x", 300); } if (F.Key("c") && !F.TeclaDesativada("c") && mX == 1) { mX = 0; F.DesativarTecla("x", 300); } if (F.Key("right") && !F.TeclaDesativada("menuMove") && mY == -1 && mA < 2) { mA++; F.DesativarTecla("menuMove", 175); } else if (F.Key("left") && !F.TeclaDesativada("menuMove") && mY == -1 && mA > 0) { mA--; F.DesativarTecla("menuMove", 175); } else if (F.Key("up") && !F.TeclaDesativada("menuMove") && mY > -1) { if (mX == 0) { mY--; } if (mX == 1 && hY > 0) { hY--; } F.DesativarTecla("menuMove", 175); } else if (F.Key("down") && !F.TeclaDesativada("menuMove")) { if (mX == 0 && mY < 2) { mY++; } if (mX == 1 && hY < Configuracoes.controle.skills.Count() - 3) { hY++; } F.DesativarTecla("menuMove", 175); } } } F.DesenharShape(0, Screen.height - 25, Screen.width, 25, 239, 239, 239, 230); //XP F.DesenharShape(((Screen.width - (Screen.width / 3)) / 2), Screen.height - 20, Screen.width / 3, 15, 000, 000, 000, 230); F.DesenharShape(((Screen.width - (Screen.width / 3)) / 2), Screen.height - 20, ((x.xpA - V.nivelArray[V.personagem.nivel]) / (V.nivelArray[V.personagem.nivel + 1] - V.nivelArray[V.personagem.nivel])) * (Screen.width / 3), 15, 000, 255, 000, 230); F.Escrever("XP", true, ((Screen.width - (Screen.width / 3)) / 2) - 30, Screen.height - 30, 24, 000, 000, 000, 230); //VIDA F.DesenharShape(Screen.width - 30, 80, 20, 125, 239, 239, 239, 230); F.DesenharShape(Screen.width - 30, 205, 20, (float)-(x.vidaA * 1.25), 000, 255, 000, 230); //ATALHO MENU F.DesenharShape(Screen.width - 70, 10, 60, 60, 239, 239, 239, 230); Item i = Configuracoes.controle.item; if (i != null) { V.img[1].Texture = V.IMG_CAT[5][i.sprite]; V.img[1].Scale = new Vector2f((float)60 / V.IMG_CAT[5][i.sprite].Size.X, (float)60 / V.IMG_CAT[5][i.sprite].Size.Y); V.img[1].TextureRect = new IntRect(0, 0, (int)V.IMG_CAT[5][i.sprite].Size.X, (int)V.IMG_CAT[5][i.sprite].Size.Y); V.img[1].Position = new Vector2f(Screen.width - 70, 10); V.window.Draw(V.img[1]); } }
public static void TelaPrincipal() { V.window.SetView(V.view); V.cameraX = V.view.Center.X - ((Screen.width / V.Delta) / 2); V.cameraY = V.view.Center.Y - ((Screen.height / V.Delta) / 2); if (menuCreatorTab > -1) { criarMapaX = (int)((V.mouseX + ((V.view.Center.X - (V.view.Size.X / 2)) * V.Delta)) / (V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X * V.Delta)); criarMapaY = (int)((V.mouseY + ((V.view.Center.Y - (V.view.Size.Y / 2)) * V.Delta)) / (V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y * V.Delta)); } if (F.Key("esc") && !F.TeclaDesativada("esc")) { if (menuCreatorTab == -1 || !menuCreator) { menuCreator = !menuCreator; } else { menuCreatorTab = -1; } F.DesativarTecla("esc", 200); } if (V.mouseButton == "Right") { V.view.Move(new Vector2f(-((V.mouseX - oldMouseX) / V.Delta), -((V.mouseY - oldMouseY) / V.Delta))); } if (F.Key("enter")) { V.personagem = new Personagem(1, Data.Nick(), 50, 40, 130, 50, 0, 100, false, 0, new List <Item>(), new List <Recurso>()); V.personagem.recursos[0].Add(20); V.personagem.recursos[1].Add(20); Configuracoes.Set(V.personagem); CurrentScreen.Change("localmap"); } if (criarMapaX >= 0 && criarMapaY >= 0 && !menuCreator && menuCreatorPos == 0) { if (F.Key("lcontrol")) { V.img[0].Color = (V.mouseButton == "Left") ? new Color(255, 0, 0, 255) : new Color(255, 0, 0, 120); } else { V.img[0].Color = (V.mouseButton == "Left") ? new Color(255, 255, 255, 255) : new Color(255, 255, 255, 120); } if (V.mouseButton == "Left" && !F.TeclaDesativada("mouseLeft")) { Geral geral; Chao criarchao; switch (menuCreatorTab) { case -1: geral = V.objetos.Find(item => F.MouseIn((item.x - (V.view.Center.X - (V.view.Size.X / 2))) * V.Delta, (item.y - (V.view.Center.Y - (V.view.Size.Y / 2))) * V.Delta, item.imgWidth * V.Delta, item.imgHeight * V.Delta)); if (geral != null) { EditarMateria(geral); } break; case 1: geral = V.objetos.Find(item => item.x == criarMapaX * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X && item.y == criarMapaY * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y); if (geral != null && F.Key("lcontrol")) { V.objetos.RemoveAt(V.objetos.IndexOf(geral)); } if (geral == null && !F.Key("lcontrol")) { V.objetos.Add(new Npc(0, spriteTemp, criarMapaX * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X, criarMapaY * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y, 120, 120, 0, 0, 100, 5, false, false, false, "", new int[] {}, false)); } break; case 2: criarchao = V.chao.Find(item => item.x == criarMapaX * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X && item.y == criarMapaY * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y); if (criarchao != null && F.Key("lcontrol")) { V.chao.RemoveAt(V.chao.IndexOf(criarchao)); } if (criarchao == null && !F.Key("lcontrol")) { V.chao.Add(new Chao(spriteTemp, criarMapaX, criarMapaY)); } break; } } if (menuCreatorTab >= 0) { V.img[0].Position = new Vector2f(V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X * criarMapaX, V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y * criarMapaY); V.img[0].TextureRect = new IntRect(0, 0, (int)V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X, (int)V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y); V.img[0].Texture = V.IMG_CAT[menuCreatorTab][spriteTemp]; V.window.Draw(V.img[0]); } V.img[0].Color = new Color(255, 255, 255, 255); } V.window.SetView(V.hud); if (menuCreator && menuCreatorPos < 250) { menuCreatorPos += 25; } else if (!menuCreator && !editarMateria1 && menuCreatorPos > 0) { menuCreatorPos -= 25; } F.DesenharShape(Screen.width - menuCreatorPos, 0, 250, Screen.height, 19, 19, 19, 230); if (menuCreatorTab == -1 && !editarMateria1) { int m = 0; foreach (var tab in V.mapCreatorTabs) { if (tab.Value) { F.DesenharShape(Screen.width - menuCreatorPos, 110 * m, menuCreatorPos, 55, 35, 35, 35, 230); F.Escrever(tab.Key, false, Screen.width - menuCreatorPos + 125 - (F.TxtWidth(tab.Key, 32, false) / 2), 5 + (55 * m), 32, 255, 255, 255, 255); if (V.mouseButton == "Left" && F.MouseIn(Screen.width - menuCreatorPos, 55 * m, menuCreatorPos, 55) && tab.Value && menuCreator) { F.DesativarTecla("mouseLeft", 500); menuCreatorTab = m; } m++; } } } if (menuCreatorTab != -1) { F.Escrever(V.mapCreatorTabs.ElementAt(menuCreatorTab).Key, false, Screen.width - menuCreatorPos + 125 - (F.TxtWidth(V.mapCreatorTabs.ElementAt(menuCreatorTab).Key, 32, false) / 2), 5, 32, 255, 255, 255, 255); if (F.Button("Upload", 32, Screen.width - menuCreatorPos + 25, Screen.height - 75, 200, 50, 221, 66, 82, 255) && !F.TeclaDesativada("mouseLeft") && menuCreator) { int m = 0; OpenFileDialog theDialog = new OpenFileDialog(); theDialog.Title = "Selecione uma imagem"; theDialog.Filter = "PNG|*.png"; V.mouseButton = ""; if (theDialog.ShowDialog() == DialogResult.OK) { while (System.IO.File.Exists(@"res\img\chao\" + m + ".png")) { m++; } string destFile = System.IO.Path.Combine(@"res\img\chao", m + ".png"); System.IO.File.Copy(theDialog.FileName, destFile, true); V.IMG_CAT[menuCreatorTab].Clear(); V.ImgLoad(); } } } V.window.SetView(V.menuCreator); if (menuCreatorTab != -1) { paddingTop = 0; for (int m = 0; m < V.IMG_CAT[menuCreatorTab].Count; m++) { paddingTop += (int)V.IMG_CAT[menuCreatorTab][m].Size.Y + 10; } if (V.menuCreator.Center.Y >= 215 && V.menuCreator.Center.Y <= paddingTop - 225 && menuCreator) { V.menuCreator.Move(new Vector2f(0, V.smoothScroll)); if (V.mouseWheel > 0 || V.mouseWheel < 0) { V.smoothScroll += -V.mouseWheel * 10; } } if (V.menuCreator.Center.Y <= 215) { V.smoothScroll = 0; V.menuCreator.Move(new Vector2f(0, 216 - V.menuCreator.Center.Y)); } if (V.menuCreator.Center.Y >= paddingTop - 225) { V.smoothScroll = 0; V.menuCreator.Move(new Vector2f(0, -(V.menuCreator.Center.Y - (paddingTop - 226)))); } if (V.smoothScroll > 0) { V.smoothScroll--; } if (V.smoothScroll < 0) { V.smoothScroll++; } paddingTop = 0; for (int m = 0; m < V.IMG_CAT[menuCreatorTab].Count; m++) { if (V.IMG_CAT[menuCreatorTab][m].Size.X > 115) { V.img[0].Scale = new Vector2f((float)(115 / (float)V.IMG_CAT[menuCreatorTab][m].Size.X), (float)(115 / (float)V.IMG_CAT[menuCreatorTab][m].Size.X)); V.img[0].Position = new Vector2f(250 - menuCreatorPos + 125 - ((V.IMG_CAT[menuCreatorTab][m].Size.X * (float)(115 / (float)V.IMG_CAT[menuCreatorTab][m].Size.X)) / 2), paddingTop); } else { V.img[0].Position = new Vector2f(250 - menuCreatorPos + 125 - (V.IMG_CAT[menuCreatorTab][m].Size.X / 2), paddingTop); } V.img[0].TextureRect = new IntRect(0, 0, 115, (int)V.IMG_CAT[menuCreatorTab][m].Size.Y); V.img[0].Texture = V.IMG_CAT[menuCreatorTab][m]; V.window.Draw(V.img[0]); if (V.mouseButton == "Left" && F.MouseIn(Screen.width - menuCreatorPos + 70, (100 * m) + 275 - V.menuCreator.Center.Y, 115, 90) && !F.TeclaDesativada("mouseLeft") && menuCreator) { spriteTemp = m; menuCreator = false; F.DesativarTecla("mouseLeft", 500); } paddingTop += V.IMG_CAT[menuCreatorTab][m].Size.X > 115 ? (int)(V.IMG_CAT[menuCreatorTab][m].Size.Y * (float)(115 / (float)V.IMG_CAT[menuCreatorTab][m].Size.X)) + 10 : (int)V.IMG_CAT[menuCreatorTab][m].Size.Y + 10; V.img[0].Scale = new Vector2f(1, 1); } } V.window.SetView(V.hud); if (!menuCreator) { float zoom = 1; zoom -= (float)V.mouseWheel / 10; V.view.Zoom(zoom); V.Delta = Screen.width / V.view.Size.X; F.Escrever(V.Delta + "x", true, Screen.width - F.TxtWidth(V.Delta + "x", 32, true) - 10, Screen.height - 40, 32, 255, 255, 255, 255, 0, 0, 0, 255, 2); } if (editarMateria1) { EditarMateriaF(); } oldMouseX = V.mouseX; oldMouseY = V.mouseY; }
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); } }
public static void Video1() { V.img[0].Texture = V.IMG_CAT[1][3]; V.img[0].TextureRect = new IntRect(0, 0, (int)npc.imgWidth, (int)npc.imgHeight); V.img[0].Position = new Vector2f(npcX, npcY); V.img[0].Color = new Color(255, 255, 255, 255); V.window.Draw(V.img[0]); V.img[0].Texture = V.IMG_CAT[13][0]; V.img[0].TextureRect = new IntRect(0, 0, 160, 96); V.img[0].Position = new Vector2f(npcX - 350, npcY + 150); V.img[0].Color = new Color(255, 255, 255, (byte)cowOpacity); V.window.Draw(V.img[0]); F.Escrever("-Nome", true, npcX - 350 + 80 - (F.TxtWidth("-Nome", 30, true) / 2), npcY + 280 + atributoUmY, 30, 000, 000, 000, (byte)atributoUm); F.Escrever("-Peso", true, npcX - 350 + 80 - (F.TxtWidth("-Peso", 30, true) / 2), npcY + 310 + atributoDoisY, 30, 000, 000, 000, (byte)atributoDois); F.Escrever("-Altura", true, npcX - 350 + 80 - (F.TxtWidth("-Altura", 30, true) / 2), npcY + 340 + atributoTresY, 30, 000, 000, 000, (byte)atributoTres); float o = cowOpacity > 200 ? 200 : cowOpacity; F.DesenharShape(npcX + 180, npcY + 145, 290, 120, 000, 000, 000, o); new RichText(npcX + 190, npcY + 150, 24, true, (byte)cowOpacity, @"#3da3efVaca #ffffffvaca #f92659= new #3da3efVaca#ffffff();/n/nvaca.nome #f92659= #e6db5a""Loló""#ffffff;/nvaca.peso #f92659= #ae81ff720#3da3eff#ffffff;/nvaca.altura #f92659= #ae81ff1.5#3da3eff#ffffff;"); V.img[0].Color = new Color(255, 255, 255, 255); switch (step) { case 0: if (Efeitos.opacidade >= 255 && npcY > 50) { npcY--; } else if (npcY <= 50 && Efeitos.opacidade >= 50) { step++; } break; case 1: if (F.txtAlerta == "") { F.Alerta("Até onde sabemos, a #ff0000torre #ffffffpossui somente um enigma. /nPara resolvê-lo, você precisará saber o que são #00ffffobjetos #ffffffe #00ffffatributos#ffffff."); } if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { F.Alerta("Em resumo, um #00ffffobjeto #ffffffé uma #ff0000variável #ffffffque pode armazenar vários valores./n/n/n/n/n/n/n/n~Uma #ff0000variável #ffffffé algo que pode armazenar um valor, como um número ou uma palavra~"); step++; } break; case 2: if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { F.Alerta("Chamamos esses valores de #00ffffatributos."); step++; } break; case 3: if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { F.Alerta("Um exemplo?/nHmmm.../nAh, Claro!"); step++; } break; case 4: if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { F.Alerta("O #00ffffobjeto #ff0000vaca #ffffffpossui os #00ffffatributos #ffffffnome, peso e altura."); step++; } break; case 5: if (F.letraAtual >= 24 && cowOpacity < 255) { cowOpacity += 2.55f; } if (F.letraAtual >= 70) { if (atributoUm < 255) { atributoUm += 2.55f; } if (atributoUmY > 0) { atributoUmY -= 1; } } if (F.letraAtual >= 76) { if (atributoDois < 255) { atributoDois += 2.55f; } if (atributoDoisY > 0) { atributoDoisY -= 1; } } if (F.letraAtual >= 83) { if (atributoTres < 255) { atributoTres += 2.55f; } if (atributoTresY > 0) { atributoTresY -= 1; } } if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { F.Alerta("O quê? Sim, uma vaca é um animal, e não um objeto.../nNão sei se conseguiria explicar isso, talvez alguém de outra cidade consiga."); step++; } break; case 6: if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { cowOpacity = 255; atributoUm = 255; atributoDois = 255; atributoTres = 255; Efeitos.opacidade = 255; step++; } break; case 7: cowOpacity -= cowOpacity <= 0 ? cowOpacity : 2.55f; atributoUm -= atributoUm <= 0 ? atributoUm : 2.55f; atributoDois -= atributoDois <= 0 ? atributoDois : 2.55f; atributoTres -= atributoTres <= 0 ? atributoTres : 2.55f; if (cowOpacity <= 0) { if (npcY < (npc.y + npc.height - npc.imgHeight) - (V.view.Center.Y - (Screen.height / 2))) { npcY++; } else if (npcY >= (npc.y + npc.height - npc.imgHeight) - (V.view.Center.Y - (Screen.height / 2)) && Efeitos.opacidade > 0) { Efeitos.opacidade -= 2.55f; Efeitos.Backdrop("fade-out-white", 0, 2.55f); step++; } } break; case 8: if (Efeitos.opacidade <= 0) { V.objetos[V.objetos.IndexOf(npc)].step = 0; CurrentScreen.Change("localmap"); } break; } }
public static void TelaPrincipal() { V.window.SetView(V.view); foreach (Background x in V.background.ToList()) { x.Draw(); } V.window.SetView(V.hud); F.DesenharShape(Screen.width / 2 - F.TxtWidth("Start", 32, false) / 2 - 10, Screen.height - 117, F.TxtWidth("Start", 32, false) + 25, 35, 255, 255, 255, 255); F.Escrever("How to play", true, Screen.width / 2 - F.TxtWidth("How to play", 50, true) / 2, 20, 50, 255, 255, 255, 255); F.Escrever("Start", true, Screen.width / 2 - F.TxtWidth("Start", 32, true) / 2, Screen.height - 122, 32, 000, 000, 000, 255); F.Escrever("v1.0", false, Screen.width - F.TxtWidth("v1.0", 32, false) - 30, Screen.height - 50, 32, 255, 255, 255, 255); V.img[0].Scale = new Vector2f(2, 2); V.img[0].Texture = V.IMG_CAT[1][8]; V.img[0].TextureRect = new IntRect(0, 0, 130, 55); V.img[0].Position = new Vector2f(!V.multiplayer ? Screen.width / 2 - 130 : Screen.width * 0.3f - 130, 200); V.window.Draw(V.img[0]); V.img[0].Texture = V.IMG_CAT[1][9]; V.img[0].TextureRect = new IntRect(0, 0, 48, 37); V.img[0].Position = new Vector2f(!V.multiplayer ? Screen.width / 2 - 130 : Screen.width * 0.3f - 130, 350); V.window.Draw(V.img[0]); F.Escrever("Move", false, !V.multiplayer ? Screen.width / 2 - 105 : Screen.width * 0.3f - 105, 282, 24, 255, 255, 255, 255); F.Escrever("Special", false, !V.multiplayer ? Screen.width / 2 - 110 : Screen.width * 0.3f - 110, 396, 24, 255, 255, 255, 255); F.Escrever("Fire", false, !V.multiplayer ? Screen.width / 2 + 30 : Screen.width * 0.3f + 30, 282, 24, 255, 255, 255, 255); if (V.multiplayer) { V.img[0].Texture = V.IMG_CAT[1][7]; V.img[0].TextureRect = new IntRect(0, 0, 130, 56); V.img[0].Position = new Vector2f(Screen.width * 0.7f - 130, 200); V.window.Draw(V.img[0]); F.Escrever("Move", false, Screen.width * 0.7f - 105, 284, 24, 255, 255, 255, 255); F.Escrever("Fire", false, Screen.width * 0.7f + 50, 284, 24, 255, 255, 255, 255); F.Escrever("Player 1", true, Screen.width * 0.3f - F.TxtWidth("Player 1", 32, true) / 2, 130, 32, 255, 255, 255, 255); F.Escrever("Player 2", true, Screen.width * 0.7f - F.TxtWidth("Player 2", 32, true) / 2, 130, 32, 255, 255, 255, 255); } V.img[0].Scale = new Vector2f(1, 1); if (start == 1 && Efeitos.opacidade == 255) { CurrentScreen.Change("play"); } if (F.Key("space") && !F.TeclaDesativada("space") && start == 0) { Efeitos.Backdrop("fade-in", 255, 2.5f); start = 1; F.DesativarTecla("space", 175); } if (F.Key("esc") && !F.TeclaDesativada("esc") && start == 0) { CurrentScreen.Change("mainmenu"); F.DesativarTecla("esc", 175); } }
public static void TelaPrincipal() { if ((F.Key("esc") || F.Key("c")) && !F.TeclaDesativada("voltar")) { CurrentScreen.Change("mainmenu"); F.DesativarTecla("voltar", 200); } F.DesenharShape(0, 0, Screen.width, Screen.height, 19, 19, 19, 255); F.Escrever("Configurações", true, Screen.width - F.TxtWidth("Configurações", 50, true) - 30, 20, 50, 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); string[] opcoes = { "Tela Cheia", "VSync", "Controles", "Conectar Joystick" }; for (int m = 0; m < opcoes.Count(); m++) { byte c = (JoystickState.connected && m == 3) ? (byte)125 : (byte)255; F.Escrever(opcoes[m], false, Screen.width - 350, Screen.height / 2 - 40 + 40 * m, 32, c, c, c, 255); } F.Escrever(Screen.fullscreen ? "ON" : "OFF", false, (Screen.fullscreen ? -52 : -58) + Screen.width - F.TxtWidth("OFF", 32, false), Screen.height / 2 - 40, 32, 255, 255, 255, 255); F.Escrever(Configuracoes.vsync ? "ON" : "OFF", false, (Configuracoes.vsync ? -52 : -58) + Screen.width - F.TxtWidth("OFF", 32, false), Screen.height / 2, 32, 255, 255, 255, 255); if (option < 2) { V.img[0].Texture = V.IMG_CAT[8][1]; V.img[0].TextureRect = new IntRect(0, 0, 18, 15); V.img[0].Position = new Vector2f(Screen.width - 51, (Screen.height / 2) - 25 + (40 * option)); V.window.Draw(V.img[0]); V.img[0].Texture = V.IMG_CAT[8][2]; V.img[0].TextureRect = new IntRect(0, 0, 18, 15); V.img[0].Position = new Vector2f(Screen.width - 80 - F.TxtWidth("OFF", 32, false), (Screen.height / 2) - 25 + (40 * option)); V.window.Draw(V.img[0]); } 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 - 387, (Screen.height / 2) - 25 + (40 * option)); V.window.Draw(V.img[0]); if ((F.Key("up") && !F.TeclaDesativada("option")) && option > 0) { option--; F.DesativarTecla("option", 175); } else if ((F.Key("down") && !F.TeclaDesativada("option")) && option < opcoes.Length - 1) { option++; F.DesativarTecla("option", 175); } else if ((F.Key("left") && !F.TeclaDesativada("option"))) { SetValue(option, false); F.DesativarTecla("option", 175); } else if ((F.Key("right") && !F.TeclaDesativada("option"))) { SetValue(option, true); F.DesativarTecla("option", 175); } else if (F.Key("x") && !F.TeclaDesativada("x")) { ChangeState(option); F.DesativarTecla("x", 175); } }
public static void LoadFile(int file) { SQLiteDataReader reader; int mapa = 1, x = 400, y = 500; V.objetos.Clear(); V.tempObjects.Clear(); V.lockedObjects.Clear(); List <Item> a = new List <Item>(); List <Recurso> b = new List <Recurso>(); reader = Conexao.LoadData("select x, y, mapa from saveFile A inner join savePoint B where A.savePoint = B.id and A.id = '" + file + "'"); while (reader.Read()) { x = Convert.ToInt32(reader["x"]); y = Convert.ToInt32(reader["y"]) + 50; mapa = Convert.ToInt32(reader["mapa"]); } reader = Conexao.LoadData("select * from objeto_item where objeto_id = 1 and saveFile_id = '" + file + "'"); while (reader.Read()) { a.Add(V.itens[Convert.ToInt32(reader["item_id"]) - 1]); } reader = Conexao.LoadData("select * from objeto_recurso where objeto_id = 1 and saveFile_id = '" + file + "'"); while (reader.Read()) { Recurso r = V.recursos[Convert.ToInt32(reader["recurso_id"]) - 1]; Recurso n = (Recurso)r.Clone(); b.Add(n); b[b.IndexOf(n)].Add(Convert.ToInt32(reader["quantidade"])); } reader = Conexao.LoadData("select B.id, A.width, A.height, A.xp, A.vida, C.interior from objeto A inner join objeto_mapa B inner join mapa C on A.id = B.objeto_id and B.mapa = C.id where categoria = 1 and playable = 'true'"); while (reader.Read()) { V.personagem = null; V.personagem = new Personagem(Convert.ToInt32(reader["id"]), Data.Nick(), x, y, Convert.ToInt32(reader["width"]), Convert.ToInt32(reader["height"]), Convert.ToInt32(reader["xp"]), Convert.ToInt32(reader["vida"]), Convert.ToBoolean(reader["interior"]), mapa, a, b); Configuracoes.Set(V.personagem); } reader = Conexao.LoadData("select * from objeto_savefile where saveFile_id = '" + file + "' and activated = 'true'"); while (reader.Read()) { V.tempObjects[Convert.ToInt32(reader["objeto_id"])] = Convert.ToBoolean(reader["activated"]); } reader = Conexao.LoadData("select * from objeto_locked where saveFile_id = '" + file + "' and locked = 'false'"); while (reader.Read()) { V.lockedObjects[Convert.ToInt32(reader["objeto_id"])] = Convert.ToBoolean(reader["locked"]); } V.personagem.AddSkill(V.skills[0]); V.personagem.AddSkill(V.skills[1]); V.personagem.AddSkill(V.skills[3]); V.personagem.AddSkill(V.skills[2]); V.personagem.AddSkill(V.skills[4]); V.personagem.AddSkill(V.skills[5]); Idk.LoadMap(mapa, false); CurrentScreen.Change("localmap"); }
public static void TelaPrincipal() { if (F.Key("esc") || F.Key("c")) { CurrentScreen.Change("mainmenu"); } F.DesenharShape(0, 0, Screen.width, Screen.height, 19, 19, 19, 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); F.Escrever("Selecione um arquivo", true, Screen.width - F.TxtWidth("Selecione um arquivo", 36, true) - 30, 20, 36, 255, 255, 255, 255); for (int m = 0; m < 4; m++) { byte shapeColor = (m == option && !editing) ? (byte)180 : (byte)35; byte fontColor = (m == option && !editing) ? (byte)255 : (byte)112; string txt = !LoadFileState.saveFiles[m].Empty() ? LoadFileState.saveFiles[m].mapaNome : "-Empty-"; F.DesenharShape(Screen.width - 330, 110 + (105 * m), 310, 80, shapeColor, shapeColor, shapeColor, 255); F.Escrever(txt, true, Screen.width - 175 - (F.TxtWidth(txt, 31, true) / 2), 125 + (105 * m), 31, fontColor, fontColor, fontColor, 255); if (!LoadFileState.saveFiles[m].Empty()) { for (int n = 0; n < 2; n++) { shapeColor = (m == option && n == editingOption && editing) ? (byte)180 : (byte)35; F.DesenharShape(Screen.width - 380, 110 + (45 * n) + (105 * m), 40, 35, shapeColor, shapeColor, shapeColor, 255); V.img[0].Texture = V.IMG_CAT[8][3 + n]; V.img[0].TextureRect = new IntRect(0, 0, 26, 24); V.img[0].Position = new Vector2f(Screen.width - 373, 114 + (45 * n) + (105 * m)); V.window.Draw(V.img[0]); } } } if (F.Key("up") && !F.TeclaDesativada("option")) { if (editing && editingOption > 0) { editingOption--; } else if (!editing && option > 0) { option--; } F.DesativarTecla("option", 175); } else if (F.Key("down") && !F.TeclaDesativada("option")) { if (editing && editingOption < 1) { editingOption++; } else if (!editing && option < 3) { option++; } F.DesativarTecla("option", 175); } else if (F.Key("left") && !F.TeclaDesativada("option") && !editing && !LoadFileState.saveFiles[option].Empty() && !copying) { editing = true; F.DesativarTecla("option", 175); } else if (F.Key("right") && !F.TeclaDesativada("option") && editing) { editing = false; F.DesativarTecla("option", 175); } else if (F.Key("x") && !F.TeclaDesativada("x")) { if (editing) { if (editingOption == 0) { DeleteFile(option + 1); } if (editingOption == 1) { copyingOption = option + 1; editing = false; copying = true; } } else if (copying) { CopyFile(copyingOption, option + 1); copying = false; } else { LoadFile(option + 1); } F.DesativarTecla("x", 175); } }
public static void Video2() { V.img[0].Texture = V.IMG_CAT[1][6]; V.img[0].TextureRect = new IntRect(0, 0, (int)npc.imgWidth, (int)npc.imgHeight); V.img[0].Position = new Vector2f(npcX, npcY); V.img[0].Color = new Color(255, 255, 255, 255); V.window.Draw(V.img[0]); V.img[0].Texture = V.IMG_CAT[13][1]; V.img[0].TextureRect = new IntRect(0, 0, 100, 88); V.img[0].Position = new Vector2f(npcX - 350, npcY + 150); V.img[0].Color = new Color(255, 255, 255, (byte)cowOpacity); V.window.Draw(V.img[0]); F.Escrever("-Latir", true, npcX - 370 + 80 - (F.TxtWidth("-Latir", 30, true) / 2), npcY + 280 + atributoUmY, 30, 000, 000, 000, (byte)atributoUm); F.Escrever("-Dormir", true, npcX - 370 + 80 - (F.TxtWidth("-Dormir", 30, true) / 2), npcY + 310 + atributoDoisY, 30, 000, 000, 000, (byte)atributoDois); F.Escrever("-Comer", true, npcX - 370 + 80 - (F.TxtWidth("-Comer", 30, true) / 2), npcY + 340 + atributoTresY, 30, 000, 000, 000, (byte)atributoTres); float o = cowOpacity > 200 ? 200 : cowOpacity; F.DesenharShape(npcX + 180, npcY + 145, 355, 120, 000, 000, 000, o); new RichText(npcX + 190, npcY + 150, 24, true, (byte)cowOpacity, @"#f92659public static #3da3efvoid #a6e22eLatir#ffffff(){}/n/n#f92659public static #3da3efvoid #a6e22eDormir#ffffff(){}/n/n#f92659public static #3da3efvoid #a6e22eComer#ffffff(){}/n"); V.img[0].Color = new Color(255, 255, 255, 255); switch (step) { case 0: if (Efeitos.opacidade >= 255 && npcY > 50) { npcY--; } else if (npcY <= 50 && Efeitos.opacidade >= 50) { step++; } break; case 1: if (F.txtAlerta == "") { F.Alerta("Não quero perder meu tempo, então vou explicar resumidamente..."); } if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { F.Alerta("Dentro da programação, #00ffffmétodos #fffffffuncionam como #ff0000scripts./n/n/n/n/n/n/n/n~#ffffffUm #ff0000script #ffffffé um conjunto de comandos~"); step++; } break; case 2: if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { F.Alerta("Por exemplo, o #00ffffobjeto #ff0000cachorro #ffffffpossui os #00ffffmétodos #ffffffLatir, Dormir e Comer."); step++; } break; case 3: if (F.letraAtual >= 24 && cowOpacity < 255) { cowOpacity += 2.55f; } if (F.letraAtual >= 70) { if (atributoUm < 255) { atributoUm += 2.55f; } if (atributoUmY > 0) { atributoUmY -= 1; } } if (F.letraAtual >= 76) { if (atributoDois < 255) { atributoDois += 2.55f; } if (atributoDoisY > 0) { atributoDoisY -= 1; } } if (F.letraAtual >= 83) { if (atributoTres < 255) { atributoTres += 2.55f; } if (atributoTresY > 0) { atributoTresY -= 1; } } if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { F.Alerta("Bem, esse é o conceito de um #00ffffmétodo#ffffff, agora me deixe trabalhar."); step++; } break; case 4: if (F.Key("x") && !F.TeclaDesativada("x") && F.letraAtual >= F.txtAlerta.Length && Configuracoes.letraTempo == 50) { cowOpacity = 255; atributoUm = 255; atributoDois = 255; atributoTres = 255; Efeitos.opacidade = 255; step++; } break; case 5: cowOpacity -= cowOpacity <= 0 ? cowOpacity : 2.55f; atributoUm -= atributoUm <= 0 ? atributoUm : 2.55f; atributoDois -= atributoDois <= 0 ? atributoDois : 2.55f; atributoTres -= atributoTres <= 0 ? atributoTres : 2.55f; if (cowOpacity <= 0) { if (npcY < (npc.y + npc.height - npc.imgHeight) - (V.view.Center.Y - (Screen.height / 2))) { npcY++; } else if (npcY >= (npc.y + npc.height - npc.imgHeight) - (V.view.Center.Y - (Screen.height / 2)) && Efeitos.opacidade > 0) { Efeitos.opacidade -= 2.55f; Efeitos.Backdrop("fade-out-white", 0, 2.55f); step++; } } break; case 6: if (Efeitos.opacidade <= 0) { V.objetos[V.objetos.IndexOf(npc)].step = 0; CurrentScreen.Change("localmap"); } break; } }