public CharSprite() { CharLoc = new Loc2D(); ActionDone = true; Dead = true; }
public MenuText(string text, Loc2D loc) { Text = text; Loc = loc; Color = Color4.White; }
public MenuText(string text, Loc2D loc, Color4 color) { Text = text; Loc = loc; Color = color; }
public static int Dot(Loc2D param1, Loc2D param2) { return(param1.X * param2.X + param1.Y * param2.Y); }
public static void Draw(int fps) { //draw menus on top //if (ShowTitle) { // Graphics.TextureManager.TextureProgram.SetModelView(Matrix4.Identity); // Graphics.TextureManager.TextureProgram.LeftMultModelView( // Matrix4.CreateTranslation(TextureManager.SCREEN_WIDTH / 2 - TextureManager.Title.ImageWidth / 2, // TextureManager.SCREEN_HEIGHT / 2 - TextureManager.Title.ImageHeight / 2, 1)); // Graphics.TextureManager.TextureProgram.UpdateModelView(); // Graphics.TextureManager.Title.Render(null); // Graphics.TextureManager.TextureProgram.SetModelView(Matrix4.Identity); // Gameplay.MenuManager.DrawMenus(); //} float scale = GetZoomScale(Zoom); Loc2D camCenter = new Loc2D(FocusedCharacter.CharLoc.X * TextureManager.TILE_SIZE + TextureManager.TILE_SIZE / 2, FocusedCharacter.CharLoc.Y * TextureManager.TILE_SIZE + TextureManager.TILE_SIZE / 2); camCenter = camCenter + CamOffset; Loc2D camStart = new Loc2D((int)(camCenter.X - TextureManager.SCREEN_WIDTH / scale / 2), (int)(camCenter.Y - TextureManager.SCREEN_HEIGHT / scale / 2)); Loc2D camEnd = new Loc2D((int)(camCenter.X + TextureManager.SCREEN_WIDTH / scale / 2), (int)(camCenter.Y + TextureManager.SCREEN_HEIGHT / scale / 2)); Loc2D camStartTile = new Loc2D(camStart.X / TextureManager.TILE_SIZE - 1, camStart.Y / TextureManager.TILE_SIZE - 1); Loc2D camEndTile = new Loc2D(camEnd.X / TextureManager.TILE_SIZE + 1, camEnd.Y / TextureManager.TILE_SIZE + 1); //TextureManager.TextureProgram.SetModelView(Matrix4.CreateTranslation(TextureManager.SCREEN_WIDTH / 2, TextureManager.SCREEN_HEIGHT / 2, 0)); //TextureManager.TextureProgram.SetModelView(Matrix4.CreateTranslation(-camCenter.X * scale, -camCenter.Y * scale, 0)); TextureManager.TextureProgram.SetModelView(Matrix4.CreateTranslation(-camCenter.X * scale + TextureManager.SCREEN_WIDTH / 2, -camCenter.Y * scale + TextureManager.SCREEN_HEIGHT / 2, 0)); TextureManager.TextureProgram.LeftMultModelView(Matrix4.CreateScale(scale)); //draw the background TextureManager.TextureProgram.PushModelView(); TextureManager.TextureProgram.SetTextureColor(new Color4(128, 128, 128, 255)); TextureManager.TextureProgram.LeftMultModelView(Matrix4.CreateScale(Math.Min(Map.Width, camEndTile.X) * TextureManager.TILE_SIZE, Math.Min(Map.Height, camEndTile.Y) * TextureManager.TILE_SIZE, 1)); TextureManager.TextureProgram.UpdateModelView(); TextureManager.BlankTexture.Render(null); TextureManager.TextureProgram.SetTextureColor(Color4.White); TextureManager.TextureProgram.PopModelView(); for (int j = camStartTile.Y; j <= camEndTile.Y; j++) { for (int i = camStartTile.X; i <= camEndTile.X; i++) { //set tile sprite position if (i < 0 || j < 0 || i >= Map.Width || j >= Map.Height) { } else { Map.DrawGround(i * TextureManager.TILE_SIZE, j * TextureManager.TILE_SIZE, new Loc2D(i, j)); if (Turn) { Graphics.TextureManager.GetTile(1, new Loc2D(1, 0)).Render(null); } } } } //draw items foreach (ItemAnim item in Items) { if (!item.ActionDone && IsSpriteInView(camStart, camEnd, item)) { item.Draw(); } } //draw effects laid on ground List <ISprite> sortedSprites = new List <ISprite>(); foreach (ISprite effect in Effects[EffectPriority.Ground]) { if (IsSpriteInView(camStart, camEnd, effect)) { AddInOrder(sortedSprites, effect); } } int charIndex = 0; while (charIndex < sortedSprites.Count) { sortedSprites[charIndex].Draw(); charIndex++; } //draw effects in object space sortedSprites = new List <ISprite>(); //get all back effects, see if they're in the screen, and put them in the list, sorted foreach (ISprite effect in Effects[EffectPriority.Back]) { if (IsSpriteInView(camStart, camEnd, effect)) { AddInOrder(sortedSprites, effect); } } if (ShowSprites) { //check if player is in the screen, put in list foreach (PlayerSprite player in Players) { if (!player.Dead && IsSpriteInView(camStart, camEnd, player)) { AddInOrder(sortedSprites, player); } } //get all enemies, see if they're in the screen, and put them in the list, sorted foreach (NpcSprite npc in Npcs) { if (!npc.Dead && IsSpriteInView(camStart, camEnd, npc)) { AddInOrder(sortedSprites, npc); } } } //get all effects, see if they're in the screen, and put them in the list, sorted foreach (ISprite effect in Effects[EffectPriority.None]) { if (IsSpriteInView(camStart, camEnd, effect)) { AddInOrder(sortedSprites, effect); } } //draw object charIndex = 0; for (int j = camStartTile.Y; j <= camEndTile.Y; j++) { //before drawing objects, draw all active effects behind objects for (int i = camStartTile.X; i <= camEndTile.X; i++) { //set tile sprite position if (i < 0 || j < 0 || i >= Map.Width || j >= Map.Height) { } else { Map.DrawPropBack(i * TextureManager.TILE_SIZE, j * TextureManager.TILE_SIZE, new Loc2D(i, j)); } } //after drawing objects of the row, draw characters whose locations are of between that row(inc) to the next(exc) while (charIndex < sortedSprites.Count) { int charY = sortedSprites[charIndex].MapLoc.Y; if (charY == j * TextureManager.TILE_SIZE) { sortedSprites[charIndex].Draw(); charIndex++; } else { break; } } for (int i = camStartTile.X; i <= camEndTile.X; i++) { //set tile sprite position if (i < 0 || j < 0 || i >= Map.Width || j >= Map.Height) { } else { Map.DrawPropFront(i * TextureManager.TILE_SIZE, j * TextureManager.TILE_SIZE, new Loc2D(i, j)); } } //after drawing objects of the row, draw characters whose locations are of between that row(inc) to the next(exc) while (charIndex < sortedSprites.Count) { int charY = sortedSprites[charIndex].MapLoc.Y; if (charY < (j + 1) * TextureManager.TILE_SIZE) { sortedSprites[charIndex].Draw(); charIndex++; } else { break; } } } //draw remaining sprites while (charIndex < sortedSprites.Count) { sortedSprites[charIndex].Draw(); charIndex++; } //draw effects in top sortedSprites = new List <ISprite>(); foreach (ISprite effect in Effects[EffectPriority.Top]) { if (IsSpriteInView(camStart, camEnd, effect)) { AddInOrder(sortedSprites, effect); } } charIndex = 0; while (charIndex < sortedSprites.Count) { sortedSprites[charIndex].Draw(); charIndex++; } //draw foreground for (int j = camStartTile.Y; j <= camEndTile.Y; j++) { for (int i = camStartTile.X; i <= camEndTile.X; i++) { //set tile sprite position if (i < 0 || j < 0 || i >= Map.Width || j >= Map.Height) { } else { Map.DrawFringe(i * TextureManager.TILE_SIZE, j * TextureManager.TILE_SIZE, new Loc2D(i, j)); if (ShowGrid) { TextureManager.TextureProgram.PushModelView(); TextureManager.TextureProgram.LeftMultModelView(Matrix4.CreateTranslation(i * TextureManager.TILE_SIZE, j * TextureManager.TILE_SIZE, 0)); TextureManager.TextureProgram.UpdateModelView(); Graphics.TextureManager.GetTile(10, new Loc2D()).Render(null); TextureManager.TextureProgram.PopModelView(); } } } } //draw effects in foreground sortedSprites = new List <ISprite>(); foreach (ISprite effect in Effects[EffectPriority.Overlay]) { if (IsSpriteInView(camStart, camEnd, effect)) { AddInOrder(sortedSprites, effect); } } charIndex = 0; while (charIndex < sortedSprites.Count) { sortedSprites[charIndex].Draw(); charIndex++; } Graphics.TextureManager.TextureProgram.SetModelView(Matrix4.Identity); Gameplay.MenuManager.DrawMenus(); //Moves Graphics.TextureManager.TextureProgram.SetModelView(Matrix4.Identity); if (Spell) { string[] keys = new string[4] { "S", "D", "X", "C" }; TextureManager.TextureProgram.LeftMultModelView(Matrix4.CreateTranslation(-240, 32, 0)); for (int i = 0; i < Gameplay.Processor.MAX_MOVE_SLOTS; i++) { TextureManager.TextureProgram.LeftMultModelView(Matrix4.CreateTranslation(0, 64, 0)); Graphics.TextureManager.TextureProgram.UpdateModelView(); if (CurrentCharMoves[i] >= 0) { Data.MoveEntry moveEntry = Data.GameData.MoveDex[CurrentCharMoves[i]]; TextureManager.SingleFont.RenderText(244, 20, keys[i] + ": (" + moveEntry.PP + "PP) " + moveEntry.Name, null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Left, 0, Color4.White); } else { TextureManager.SingleFont.RenderText(244, 20, keys[i] + ": Empty", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Left, 0, Color4.White); } } } //draw transitions if (CurrentFade == FadeType.FadeIn) { Graphics.TextureManager.TextureProgram.SetModelView(Matrix4.Identity); Graphics.TextureManager.TextureProgram.SetTextureColor(new Color4(0, 0, 0, (byte)(FadeTime.Ticks * 255 / TOTAL_FADE_TIME.Ticks))); Graphics.TextureManager.TextureProgram.LeftMultModelView(Matrix4.Scale(TextureManager.SCREEN_WIDTH, TextureManager.SCREEN_HEIGHT, 1)); Graphics.TextureManager.TextureProgram.UpdateModelView(); Graphics.TextureManager.BlankTexture.Render(null); Graphics.TextureManager.TextureProgram.SetTextureColor(Color4.White); } else if (CurrentFade == FadeType.FadeOut) { Graphics.TextureManager.TextureProgram.SetModelView(Matrix4.Identity); Graphics.TextureManager.TextureProgram.SetTextureColor(new Color4(0, 0, 0, (byte)(255 - FadeTime.Ticks * 255 / TOTAL_FADE_TIME.Ticks))); Graphics.TextureManager.TextureProgram.LeftMultModelView(Matrix4.Scale(TextureManager.SCREEN_WIDTH, TextureManager.SCREEN_HEIGHT, 1)); Graphics.TextureManager.TextureProgram.UpdateModelView(); Graphics.TextureManager.BlankTexture.Render(null); Graphics.TextureManager.TextureProgram.SetTextureColor(Color4.White); } if (ShowDebug) { DrawDebug(fps); } }
public Loc(int charIndex, Loc2D newLoc) { this.charIndex = charIndex; this.newLoc = newLoc; }
public TileTarget(Loc2D tileLoc, int distance) { TileLoc = tileLoc; Distance = distance; }
private static void ProcessWalk(ActiveChar character, ref bool moveMade) { if (character.dead) { return; } Loc2D loc = character.CharLoc; Operations.MoveInDirection8(ref loc, character.CharDir, 1); //check for blocking if (DirBlocked(character.CharDir, character)) { return; } moveMade = true; if (character.Status == Enums.StatusAilment.Freeze) { return; } character.CharLoc = loc; Display.Screen.AddResult(new Results.CreateAction(CharIndex(character), character, Display.CharSprite.ActionType.Walk)); Display.Screen.AddResult(new Results.Loc(CharIndex(character), loc)); moveMade = true; //if void, add restart if (!Operations.IsInBound(CurrentMap.Width, CurrentMap.Height, character.CharLoc.X, character.CharLoc.Y)) { //Lose(); throw new Exception("Player out of bounds"); } else { //god mode check if (Intangible) { return; } Tile tile = CurrentMap.MapArray[character.CharLoc.X, character.CharLoc.Y]; //if landed on certain tiles, present effects if (tile.Data.Type == Enums.TileType.Slippery) { //if on ice, continue to slide //but only if we're not blocked if (!DirBlocked(character.CharDir, character)) { ProcessWalk(character, ref moveMade); } } } }
public void HandleKeyDown(object sender, KeyboardKeyEventArgs e) { if (!ParseInput) { return; } Loc2D dirLoc = new Loc2D(); switch (e.Key) { case Key.Down: Operations.MoveInDirection8(ref dirLoc, Direction8.Down, 1); InputChanged = true; break; case Key.Up: Operations.MoveInDirection8(ref dirLoc, Direction8.Up, 1); InputChanged = true; break; case Key.Left: Operations.MoveInDirection8(ref dirLoc, Direction8.Left, 1); InputChanged = true; break; case Key.Right: Operations.MoveInDirection8(ref dirLoc, Direction8.Right, 1); InputChanged = true; break; case Key.X: inputStates[(int)InputType.X] = true; InputChanged = true; break; case Key.Z: inputStates[(int)InputType.Z] = true; InputChanged = true; break; case Key.C: inputStates[(int)InputType.C] = true; InputChanged = true; break; case Key.A: inputStates[(int)InputType.A] = true; InputChanged = true; break; case Key.S: inputStates[(int)InputType.S] = true; InputChanged = true; break; case Key.D: inputStates[(int)InputType.D] = true; InputChanged = true; break; case Key.Q: inputStates[(int)InputType.Q] = true; InputChanged = true; break; case Key.W: inputStates[(int)InputType.W] = true; InputChanged = true; break; case Key.Enter: inputStates[(int)InputType.Enter] = true; InputChanged = true; break; case Key.ShiftLeft: case Key.ShiftRight: Shift = true; InputChanged = true; break; case Key.F1: ShowDebug = !ShowDebug; InputChanged = true; break; case Key.F3: SpeedUp = true; InputChanged = true; break; case Key.F2: SpeedDown = true; InputChanged = true; break; #if GAME_MODE case Key.F4: Intangible = !Intangible; InputChanged = true; break; case Key.F5: Print = !Print; InputChanged = true; break; case Key.F12: Restart = !Restart; InputChanged = true; break; #endif } Direction = Operations.GetDirection8(new Loc2D(), dirLoc); }
public static void Print() { if (CurrentMapGroup != null) { int oldLeft = Console.CursorLeft; int oldTop = Console.CursorTop; Console.SetCursorPosition(0, 0); string topString = ""; string turnString = "Turn #" + (turnCount + 1); topString += String.Format("{0,-82}", turnString); topString += '\n'; for (int i = 0; i < 32 + CurrentMap.Width + 1; i++) { topString += "="; } topString += '\n'; string statString = ""; statString += " \n"; statString += "Inventory: \n"; statString += "--------------------------------\n"; for (int i = 0; i < MAX_INV_SLOTS; i++) { string invString = (i + 1).ToString("D2") + ": "; if (Inventory[i] > -1) { invString += "#" + Inventory[i] + ") " + Data.GameData.ItemDex[Inventory[i]].Name; } else { invString += "Empty"; } statString += String.Format("{0,-32}", invString); statString += '\n'; } statString += "--------------------------------\n"; statString += " \n"; statString += "Specials: \n"; statString += "--------------------------------\n"; for (int i = 0; i < MAX_MOVE_SLOTS; i++) { string moveString = (i + 1).ToString("D2") + ": "; if (i >= MAX_MOVE_SLOTS) { moveString = ""; } else if (Moves[i].MoveNum > -1) { moveString += "#" + Moves[i] + ") " + Data.GameData.MoveDex[Moves[i].MoveNum].Name; } else { moveString += "Empty"; } statString += String.Format("{0,-32}", moveString); statString += '\n'; } string mapString = ""; for (int y = 0; y < CurrentMap.Height; y++) { for (int x = 0; x < CurrentMap.Width; x++) { Loc2D loc = new Loc2D(x, y); int ind = -1; for (int i = 0; i < Npcs.Length; i++) { if (!Npcs[i].dead && Npcs[i].CharLoc == loc) { ind = i; break; } } bool containsPlayer = false; foreach (Player player in Players) { if (player.CharLoc == loc) { containsPlayer = true; break; } } if (containsPlayer) { mapString += '@'; } else if (ind > -1) { char npcChar = (char)((int)'A' + ind); mapString += npcChar; } else { if (TileBlocked(new Loc2D(x, y))) { mapString += ' '; } } } mapString += "|\n"; } string finalString = topString + CombineStrings(mapString, statString); List <string> recentMsgs = Logs.Logger.GetRecentBattleLog(6); for (int i = 0; i < recentMsgs.Count; i++) { finalString += String.Format("{0,-64}", recentMsgs[i]); finalString += '\n'; } Console.Write(finalString); Console.SetCursorPosition(oldLeft, oldTop); } }
private static void ProcessMeta() { if (CurrentInput.Intangible && !PrevInput.Intangible) { Intangible = !Intangible; Display.Screen.Intangible = Intangible; } if (CurrentInput.SpeedDown && !PrevInput.SpeedDown) { if (Display.Screen.DebugSpeed > Display.Screen.GameSpeed.Pause) { Display.Screen.DebugSpeed--; } } if (CurrentInput.SpeedUp && !PrevInput.SpeedUp) { if (Display.Screen.DebugSpeed < Display.Screen.GameSpeed.Instant) { Display.Screen.DebugSpeed++; } } if (CurrentInput.ShowDebug && !PrevInput.ShowDebug) { Display.Screen.ShowDebug = !Display.Screen.ShowDebug; } if (CurrentInput.Print && !PrevInput.Print) { allowPrint = !allowPrint; Display.Screen.Print = allowPrint; if (allowPrint) { Print(); } else { Console.Clear(); } } if (CurrentInput.Restart && !PrevInput.Restart) { Restart(); } if (CurrentInput.MouseWheel != PrevInput.MouseWheel) { int diff = CurrentInput.MouseWheel - PrevInput.MouseWheel; if (diff > Int32.MaxValue / 2) { diff = (PrevInput.MouseWheel - Int32.MinValue) + (Int32.MaxValue - CurrentInput.MouseWheel); } else if (diff < Int32.MinValue / 2) { diff = (CurrentInput.MouseWheel - Int32.MinValue) + (Int32.MaxValue - PrevInput.MouseWheel); } Display.Screen.Zoom -= diff; if (Display.Screen.Zoom < Display.Screen.GameZoom.x8Near) { Display.Screen.Zoom = Display.Screen.GameZoom.x8Near; } if (Display.Screen.Zoom > Display.Screen.GameZoom.x16Far) { Display.Screen.Zoom = Display.Screen.GameZoom.x16Far; } } if (Editors.MapEditor.mapEditing) { if (!CurrentInput.RightMouse && PrevInput.RightMouse && CurrentInput.Shift) { Loc2D coords = Display.Screen.ScreenCoordsToMapCoords(CurrentInput.MouseLoc); if (Operations.IsInBound(CurrentMap.Width, CurrentMap.Height, coords.X, coords.Y)) { FocusedCharacter.CharLoc = coords; Display.Screen.AddResult(new Results.Loc(FocusedCharIndex, FocusedCharacter.CharLoc)); } } else if (Editors.MapEditor.chosenEditMode == Editors.MapEditor.TileEditMode.Draw) { if (CurrentInput.LeftMouse) { Editors.MapEditor.PaintTile(Display.Screen.ScreenCoordsToMapCoords(CurrentInput.MouseLoc), Editors.MapEditor.GetBrush()); } else if (CurrentInput.RightMouse) { Editors.MapEditor.PaintTile(Display.Screen.ScreenCoordsToMapCoords(CurrentInput.MouseLoc), new TileAnim()); } } else if (Editors.MapEditor.chosenEditMode == Editors.MapEditor.TileEditMode.Eyedrop) { if (CurrentInput.LeftMouse) { Editors.MapEditor.EyedropTile(Display.Screen.ScreenCoordsToMapCoords(CurrentInput.MouseLoc)); } else if (PrevInput.LeftMouse) { } } else if (Editors.MapEditor.chosenEditMode == Editors.MapEditor.TileEditMode.Fill) { if (!CurrentInput.LeftMouse && PrevInput.LeftMouse) { Editors.MapEditor.FillTile(Display.Screen.ScreenCoordsToMapCoords(CurrentInput.MouseLoc), Editors.MapEditor.GetBrush()); } else if (!CurrentInput.RightMouse && PrevInput.RightMouse) { Editors.MapEditor.FillTile(Display.Screen.ScreenCoordsToMapCoords(CurrentInput.MouseLoc), new TileAnim()); } } } }
public static bool TileBlocked(Loc2D loc) { return(TileBlocked(loc, Enums.WalkMode.Normal)); }
public TileTexture(Loc2D texture, int sheet) { Texture = texture; Sheet = sheet; }
/// <summary> /// Inizializzatore componenti grafici. /// </summary> private void InitializeComponent(int picBoxXSize, int picBoxYSize) { this.components = new System.ComponentModel.Container(); this.cartinaBindingSource = new System.Windows.Forms.BindingSource(this.components); this.Sopra_button = new System.Windows.Forms.Button(); this.Sinistra_button = new System.Windows.Forms.Button(); this.Sotto_button = new System.Windows.Forms.Button(); this.Destra_button = new System.Windows.Forms.Button(); this.Azione_button = new System.Windows.Forms.Button(); this.Griglia_tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); this.Rum_button = new Button(); this.Rum_label = new Label(); this.AssLeg_button = new Button(); this.AssLeg_label = new Label(); this.BevandaDet_button = new Button(); this.BevandaDet_label = new Label(); this.AntiUbriachezza_button = new Button(); this.AntiUbriachezza_label = new Label(); this.EnergiaNave_label = new Label(); this.Ubriachezza_label = new Label(); this.Determinazione_label = new Label(); this.VitaNave_label = new Label(); this.Dobloni_label = new Label(); this.Rubini_label = new Label(); this.Scavo_button = new Button(); this.Attacca_button = new Button(); this.Griglia_pictureBox = new System.Windows.Forms.PictureBox[picBoxXSize, picBoxYSize]; ((System.ComponentModel.ISupportInitialize)(this.cartinaBindingSource)).BeginInit(); this.Griglia_tableLayoutPanel.SuspendLayout(); for (int i = 0; i < picBoxXSize; i++) { for (int j = 0; j < picBoxYSize; j++) { this.Griglia_pictureBox[i, j] = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.Griglia_pictureBox[i, j])).BeginInit(); } } this.SuspendLayout(); #region StatusNaveGiocatore int StatusStartPointX = 1090; int StatusStartPointY = 255; // // Energia Nave // this.EnergiaNave_label.Location = new System.Drawing.Point(StatusStartPointX, StatusStartPointY); this.EnergiaNave_label.Name = "EnergiaNave_label"; this.EnergiaNave_label.Size = new System.Drawing.Size(156, 15); this.EnergiaNave_label.TabIndex = 1; this.EnergiaNave_label.Text = "Punti azione: " + Gioco.Giocatore.Stats.Pa + "/" + Gioco.Giocatore.Stats.PaMax; this.EnergiaNave_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.EnergiaNave_label.AutoSize = false; // // Ubriachezza // StatusStartPointY += 18; this.Ubriachezza_label.Location = new System.Drawing.Point(StatusStartPointX, StatusStartPointY); this.Ubriachezza_label.Name = "Ubriacchezza_label"; this.Ubriachezza_label.Size = new System.Drawing.Size(156, 15); this.Ubriachezza_label.TabIndex = 1; this.Ubriachezza_label.Text = "Ubriachezza: " + Gioco.Giocatore.Ubriachezza + "/" + Gioco.Giocatore.UbriachezzaMax; this.Ubriachezza_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.Ubriachezza_label.AutoSize = false; // // Determinazione // StatusStartPointY += 18; this.Determinazione_label.Location = new System.Drawing.Point(StatusStartPointX, StatusStartPointY); this.Determinazione_label.Name = "Determinazione_label"; this.Determinazione_label.Size = new System.Drawing.Size(156, 15); this.Determinazione_label.TabIndex = 1; this.Determinazione_label.Text = "Determinazione: " + Gioco.Giocatore.Determinazione + "/" + Gioco.Giocatore.DeterminazioneMax; this.Determinazione_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.Determinazione_label.AutoSize = false; // // VitaNave // StatusStartPointY += 18; this.VitaNave_label.Location = new System.Drawing.Point(StatusStartPointX, StatusStartPointY); this.VitaNave_label.Name = "VitaNave_label"; this.VitaNave_label.Size = new System.Drawing.Size(156, 15); this.VitaNave_label.TabIndex = 1; this.VitaNave_label.Text = "Punti Vita: " + Gioco.Giocatore.Stats.Hp + "/" + Gioco.Giocatore.Stats.HpMax; this.VitaNave_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.VitaNave_label.AutoSize = false; // // Dobloni // StatusStartPointY += 36; this.Dobloni_label.Location = new System.Drawing.Point(StatusStartPointX, StatusStartPointY); this.Dobloni_label.Name = "Dobloni_label"; this.Dobloni_label.Size = new System.Drawing.Size(156, 15); this.Dobloni_label.TabIndex = 1; this.Dobloni_label.Text = "Dobloni: " + Gioco.Dominio.CassaDobloni + "$"; this.Dobloni_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.Dobloni_label.AutoSize = false; // // Rubini // StatusStartPointY += 18; this.Rubini_label.Location = new System.Drawing.Point(StatusStartPointX, StatusStartPointY); this.Rubini_label.Name = "Rubini_label"; this.Rubini_label.Size = new System.Drawing.Size(156, 15); this.Rubini_label.TabIndex = 1; this.Rubini_label.Text = "Rubini: " + Gioco.Dominio.CassaRubini; this.Rubini_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.Rubini_label.AutoSize = false; #endregion #region Joystick int JoystickStartPointX = 1090; int JoystickStartPointY = 500; // // Sopra_button // this.Sopra_button.Location = new System.Drawing.Point(JoystickStartPointX + 53, JoystickStartPointY); this.Sopra_button.Name = "Sopra_button"; this.Sopra_button.Size = new System.Drawing.Size(50, 50); this.Sopra_button.TabIndex = 1; this.Sopra_button.Text = "Sopra"; this.Sopra_button.UseVisualStyleBackColor = true; this.Sopra_button.Click += new System.EventHandler(this.Sopra_button_Click); // // Sinistra_button // FormMissione // this.Sinistra_button.Location = new System.Drawing.Point(JoystickStartPointX, JoystickStartPointY + 53); this.Sinistra_button.Name = "Sinistra_button"; this.Sinistra_button.Size = new System.Drawing.Size(50, 50); this.Sinistra_button.TabIndex = 2; this.Sinistra_button.Text = "Sinistra"; this.Sinistra_button.UseVisualStyleBackColor = true; this.Sinistra_button.Click += new System.EventHandler(this.Sinistra_button_Click); // // Sotto_button // this.Sotto_button.Location = new System.Drawing.Point(JoystickStartPointX + 53, JoystickStartPointY + 106); this.Sotto_button.Name = "Sotto_button"; this.Sotto_button.Size = new System.Drawing.Size(50, 50); this.Sotto_button.TabIndex = 3; this.Sotto_button.Text = "Sotto"; this.Sotto_button.UseVisualStyleBackColor = true; this.Sotto_button.Click += new System.EventHandler(this.Sotto_button_Click); // // Destra_button // this.Destra_button.Location = new System.Drawing.Point(JoystickStartPointX + 106, JoystickStartPointY + 53); this.Destra_button.Name = "Destra_button"; this.Destra_button.Size = new System.Drawing.Size(50, 50); this.Destra_button.TabIndex = 4; this.Destra_button.Text = "Destra"; this.Destra_button.UseVisualStyleBackColor = true; this.Destra_button.Click += new System.EventHandler(this.Destra_button_Click); // // Azione_button // this.Azione_button.Location = new System.Drawing.Point(JoystickStartPointX + 53, JoystickStartPointY + 53); this.Azione_button.Name = "Azione_button"; this.Azione_button.Size = new System.Drawing.Size(50, 50); this.Azione_button.TabIndex = 4; this.Azione_button.Text = "Passa"; this.Azione_button.Click += new System.EventHandler(this.Azione_button_Click); #endregion #region Bottoni Consumabili Loc2D consumabiliStartPoint = new Loc2D(1090, 9); // // Rum_button // this.Rum_button.Location = new System.Drawing.Point(consumabiliStartPoint.X, consumabiliStartPoint.Y); this.Rum_button.Name = "Rum_button"; this.Rum_button.Size = new System.Drawing.Size(156, 35); this.Rum_button.TabIndex = 1; this.Rum_button.Text = "Usa Rum"; this.Rum_button.UseVisualStyleBackColor = true; this.Rum_button.Click += new System.EventHandler(this.Rum_button_Click); // // Rum_label // consumabiliStartPoint.Y += 38; this.Rum_label.Location = new System.Drawing.Point(consumabiliStartPoint.X, consumabiliStartPoint.Y); this.Rum_label.Name = "Rum_label"; this.Rum_label.Size = new System.Drawing.Size(156, 15); this.Rum_label.TabIndex = 1; this.Rum_label.Text = "Rum rimasto: " + Gioco.Giocatore.Inventario.Rum; this.Rum_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.Rum_label.AutoSize = false; // // AssLeg_button // consumabiliStartPoint.Y += 18; this.AssLeg_button.Location = new System.Drawing.Point(consumabiliStartPoint.X, consumabiliStartPoint.Y); this.AssLeg_button.Name = "AssLeg_button"; this.AssLeg_button.Size = new System.Drawing.Size(156, 35); this.AssLeg_button.TabIndex = 1; this.AssLeg_button.Text = "Usa Assi"; this.AssLeg_button.UseVisualStyleBackColor = true; this.AssLeg_button.Click += new System.EventHandler(this.AssLeg_button_Click); // // AssLeg_label // consumabiliStartPoint.Y += 38; this.AssLeg_label.Location = new System.Drawing.Point(consumabiliStartPoint.X, consumabiliStartPoint.Y); this.AssLeg_label.Name = "AssLeg_label"; this.AssLeg_label.Size = new System.Drawing.Size(156, 15); this.AssLeg_label.TabIndex = 1; this.AssLeg_label.Text = "Assi rimaste: " + Gioco.Giocatore.Inventario.AssiLegno; this.AssLeg_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.AssLeg_label.AutoSize = false; // // BevandaDet_button // consumabiliStartPoint.Y += 18; this.BevandaDet_button.Location = new System.Drawing.Point(consumabiliStartPoint.X, consumabiliStartPoint.Y); this.BevandaDet_button.Name = "BevandaDet_button"; this.BevandaDet_button.Size = new System.Drawing.Size(156, 35); this.BevandaDet_button.TabIndex = 1; this.BevandaDet_button.Text = "Usa Bevanda Determinazione"; this.BevandaDet_button.UseVisualStyleBackColor = true; this.BevandaDet_button.Click += new System.EventHandler(this.BevandaDet_button_Click); // // BevandaDet_label // consumabiliStartPoint.Y += 38; this.BevandaDet_label.Location = new System.Drawing.Point(consumabiliStartPoint.X, consumabiliStartPoint.Y); this.BevandaDet_label.Name = "BevandaDet_label"; this.BevandaDet_label.Size = new System.Drawing.Size(156, 15); this.BevandaDet_label.TabIndex = 1; this.BevandaDet_label.Text = "Bevande Det Rimaste: " + Gioco.Giocatore.Inventario.BevandaDeterminazione; this.BevandaDet_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.BevandaDet_label.AutoSize = false; // // AntiUbriachezza_button // consumabiliStartPoint.Y += 18; this.AntiUbriachezza_button.Location = new System.Drawing.Point(consumabiliStartPoint.X, consumabiliStartPoint.Y); this.AntiUbriachezza_button.Name = "AntiUbriachezza_button"; this.AntiUbriachezza_button.Size = new System.Drawing.Size(156, 35); this.AntiUbriachezza_button.TabIndex = 1; this.AntiUbriachezza_button.Text = "Usa AntiUbriachezza"; this.AntiUbriachezza_button.UseVisualStyleBackColor = true; this.AntiUbriachezza_button.Click += new System.EventHandler(this.AntiUbriachezza_button_Click); // // AntiUbriachezza_label // consumabiliStartPoint.Y += 38; this.AntiUbriachezza_label.Location = new System.Drawing.Point(consumabiliStartPoint.X, consumabiliStartPoint.Y); this.AntiUbriachezza_label.Name = "AntiUbriachezza_label"; this.AntiUbriachezza_label.Size = new System.Drawing.Size(156, 15); this.AntiUbriachezza_label.TabIndex = 1; this.AntiUbriachezza_label.Text = "AntiUbriachezza rimasti: " + Gioco.Giocatore.Inventario.AntiUbriachezza; this.AntiUbriachezza_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.AntiUbriachezza_label.AutoSize = false; #endregion #region Bottoni azioni int ActionButtonStartPointX = 1090; int ActionButtonStartPointY = 400; // // Scavo_button // this.Scavo_button.Location = new System.Drawing.Point(ActionButtonStartPointX, ActionButtonStartPointY); this.Scavo_button.Name = "Scavo_button"; this.Scavo_button.Size = new System.Drawing.Size(150, 40); this.Scavo_button.TabIndex = 1; this.Scavo_button.Text = "Scava!"; this.Scavo_button.UseVisualStyleBackColor = true; this.Scavo_button.Click += new System.EventHandler(this.Scavo_button_Click); // // Attacca_button // ActionButtonStartPointY += 43; this.Attacca_button.Location = new System.Drawing.Point(ActionButtonStartPointX, ActionButtonStartPointY); this.Attacca_button.Name = "Attacca_button"; this.Attacca_button.Size = new System.Drawing.Size(150, 40); this.Attacca_button.TabIndex = 1; this.Attacca_button.Text = "Attacca: "; this.Attacca_button.UseVisualStyleBackColor = true; this.Attacca_button.Click += new System.EventHandler(this.Attacca_button_Click); ActionButtonStartPointY += 43; #endregion #region Matrice pictureBox // // Griglia_tableLayoutPanel // Inserisce nella tabella la matrice di pictureBox this.Griglia_tableLayoutPanel.Location = new System.Drawing.Point(0, 0); this.Griglia_tableLayoutPanel.Size = new System.Drawing.Size(1090, 680); this.Griglia_tableLayoutPanel.Name = "Griglia_tableLayoutPanel"; this.Griglia_tableLayoutPanel.TabIndex = 4; this.Griglia_tableLayoutPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.Griglia_tableLayoutPanel.BackgroundImage = Properties.Resources.mare; this.Griglia_tableLayoutPanel.ColumnCount = picBoxXSize; this.Griglia_tableLayoutPanel.RowCount = picBoxYSize; for (int i = 0; i < picBoxXSize; i++) { for (int j = 0; j < picBoxYSize; j++) { this.Griglia_tableLayoutPanel.Controls.Add(this.Griglia_pictureBox[i, j], i, j); } } // 50 + 3 pixel // Griglia_pictureBox[,] // Inizializza la matrice di pictureBox for (int i = 0; i < picBoxXSize; i++) { for (int j = 0; j < picBoxYSize; j++) { this.Griglia_pictureBox[i, j].Name = "Griglia_pictureBox" + i + j; this.Griglia_pictureBox[i, j].Size = new System.Drawing.Size(50, 50); this.Griglia_pictureBox[i, j].TabIndex = 0; this.Griglia_pictureBox[i, j].TabStop = false; this.Griglia_pictureBox[i, j].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; switch (missione.Griglia_numerica.Mat[i, j]) { default: case 0: //mare this.Griglia_pictureBox[i, j].BackgroundImage = Properties.Resources.mare; break; case 1: //isola this.Griglia_pictureBox[i, j].BackgroundImage = Properties.Resources.isola1; break; case 2: //montagna this.Griglia_pictureBox[i, j].BackgroundImage = Properties.Resources.montagna; break; case 3: //bandiera this.Griglia_pictureBox[i, j].BackgroundImage = Properties.Resources.bandiera; break; } } } #endregion // // MenuMissioni // 16 pixel tolti dalla cornice, 39 pixel tolti dalla barra del titolo this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1264, 681); this.Controls.Add(this.Griglia_tableLayoutPanel); this.Controls.Add(this.Azione_button); this.Controls.Add(this.Destra_button); this.Controls.Add(this.Sotto_button); this.Controls.Add(this.Sinistra_button); this.Controls.Add(this.Sopra_button); this.Controls.Add(this.Rum_button); this.Controls.Add(this.Rum_label); this.Controls.Add(this.AssLeg_button); this.Controls.Add(this.AssLeg_label); this.Controls.Add(this.BevandaDet_button); this.Controls.Add(this.BevandaDet_label); this.Controls.Add(this.AntiUbriachezza_button); this.Controls.Add(this.AntiUbriachezza_label); this.Controls.Add(this.EnergiaNave_label); this.Controls.Add(this.Ubriachezza_label); this.Controls.Add(this.Determinazione_label); this.Controls.Add(this.VitaNave_label); this.Controls.Add(this.Dobloni_label); this.Controls.Add(this.Rubini_label); this.Controls.Add(this.Scavo_button); this.Controls.Add(this.Attacca_button); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MenuMissioni_FormClosing); this.VisibleChanged += new System.EventHandler(this.OnVisibleChanged); this.Name = "MenuMissioni"; this.Text = "MenuMissioni"; ((System.ComponentModel.ISupportInitialize)(this.cartinaBindingSource)).EndInit(); this.Griglia_tableLayoutPanel.ResumeLayout(false); for (int i = 0; i < picBoxXSize; i++) { for (int j = 0; j < picBoxYSize; j++) { ((System.ComponentModel.ISupportInitialize)(this.Griglia_pictureBox[i, j])).EndInit(); } } this.ResumeLayout(false); }
public void Process(RenderTime elapsedTime) { if (Dead) { return; } if (CurrentAction == ActionType.Idle) { if (MovementSpeed < 0) { elapsedTime /= 2; } else if (MovementSpeed > 0) { elapsedTime *= 2; } } ActionTime += elapsedTime; RenderTime totalActionTime = GetActionTime(CharData, CharDir, CurrentAction); RenderTime totalPassTime = GetPassTime(CharData, CharDir, CurrentAction); if (ActionTime >= totalPassTime) { ActionDone = true; } if (ActionTime >= totalActionTime) { if (ActionLoop) { ActionTime = ActionTime % totalActionTime; } else { switch (CurrentAction) { case ActionType.None: { ActionTime = RenderTime.Zero; CurrentAction = ActionType.Idle; } break; case ActionType.Idle: { if (totalActionTime > RenderTime.Zero) { ActionTime = ActionTime % totalActionTime; } else { ActionTime = RenderTime.Zero; } } break; default: { ActionTime = RenderTime.Zero; CurrentAction = ActionType.None; } break; } } } CharFrameType = FrameType.Idle; CharFrame = 0; TileOffset = new Loc2D(); drawOffset = new Loc2D(); opacity = 255; MapHeight = 0; if (CurrentAction == ActionType.Idle) { CharFrameType = FrameType.Idle; int totalFrames = TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(CharFrameType, CharDir); if (totalFrames > 0) { CharFrame = (ActionTime.Ticks / IDLE_FRAME_LENGTH.Ticks) % totalFrames; } TileOffset = new Loc2D(); MapHeight = 0; } else if (CurrentAction == ActionType.Walk) { CharFrameType = FrameType.Walk; int totalFrames = TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(CharFrameType, CharDir); if (totalFrames > 0) { CharFrame = ((ActionTime + PrevActionTime).Ticks / WALK_FRAME_LENGTH.Ticks) % totalFrames; } if (!MoveInPlace) { if (ActionTime.Ticks <= totalPassTime.Ticks) { Operations.MoveInDirection8(ref TileOffset, CharDir, ActionTime.Ticks * TextureManager.TILE_SIZE / totalPassTime.Ticks); } } } else if (CurrentAction == ActionType.Attack) { CharFrameType = FrameType.Attack; int totalFrames = TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(CharFrameType, CharDir); if (totalFrames > 0) { CharFrame = (ActionTime.Ticks * totalFrames / totalActionTime.Ticks); } if (!MoveInPlace) { int pullback_distance = TextureManager.TILE_SIZE / 8; int farthest_distance = TextureManager.TILE_SIZE * 3 / 4; int hold_point = totalActionTime.Ticks / 8; int rush_point = totalActionTime.Ticks * 2 / 8; int hit_point = totalActionTime.Ticks * 4 / 8; int return_point = totalActionTime.Ticks * 6 / 8; if (ActionTime.Ticks <= hold_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, -ActionTime.Ticks * pullback_distance / rush_point); } else if (ActionTime.Ticks <= rush_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, -pullback_distance); } else if (ActionTime.Ticks <= hit_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, (ActionTime.Ticks - rush_point) * (farthest_distance + pullback_distance) / (hit_point - rush_point) - pullback_distance); } else if (ActionTime.Ticks <= return_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, farthest_distance); } else { Operations.MoveInDirection8(ref drawOffset, CharDir, ((totalActionTime.Ticks - hit_point) - (ActionTime.Ticks - hit_point)) * farthest_distance / (totalActionTime.Ticks - hit_point)); } } } else if (CurrentAction == ActionType.AttackArm) { CharFrameType = FrameType.AttackArm; int totalFrames = TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(CharFrameType, CharDir); if (totalFrames > 0) { CharFrame = (ActionTime.Ticks * totalFrames / totalActionTime.Ticks); } if (!MoveInPlace) { int pullback_distance = TextureManager.TILE_SIZE / 8; int farthest_distance = TextureManager.TILE_SIZE * 3 / 4; int hold_point = totalActionTime.Ticks / 8; int rush_point = totalActionTime.Ticks * 2 / 8; int hit_point = totalActionTime.Ticks * 4 / 8; int return_point = totalActionTime.Ticks * 6 / 8; if (ActionTime.Ticks <= hold_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, -ActionTime.Ticks * pullback_distance / rush_point); } else if (ActionTime.Ticks <= rush_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, -pullback_distance); } else if (ActionTime.Ticks <= hit_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, (ActionTime.Ticks - rush_point) * (farthest_distance + pullback_distance) / (hit_point - rush_point) - pullback_distance); } else if (ActionTime.Ticks <= return_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, farthest_distance); } else { Operations.MoveInDirection8(ref drawOffset, CharDir, ((totalActionTime.Ticks - hit_point) - (ActionTime.Ticks - hit_point)) * farthest_distance / (totalActionTime.Ticks - hit_point)); } } } else if (CurrentAction == ActionType.AltAttack) { CharFrameType = FrameType.AltAttack; int totalFrames = TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(CharFrameType, CharDir); CharFrame = (ActionTime.Ticks * totalFrames / totalActionTime.Ticks); if (!MoveInPlace) { int pullback_distance = TextureManager.TILE_SIZE / 8; int farthest_distance = TextureManager.TILE_SIZE * 3 / 4; int hold_point = totalActionTime.Ticks / 8; int rush_point = totalActionTime.Ticks * 2 / 8; int hit_point = totalActionTime.Ticks * 4 / 8; int return_point = totalActionTime.Ticks * 6 / 8; if (ActionTime.Ticks <= hold_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, -ActionTime.Ticks * pullback_distance / rush_point); } else if (ActionTime.Ticks <= rush_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, -pullback_distance); } else if (ActionTime.Ticks <= hit_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, (ActionTime.Ticks - rush_point) * (farthest_distance + pullback_distance) / (hit_point - rush_point) - pullback_distance); } else if (ActionTime.Ticks <= return_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, farthest_distance); } else { Operations.MoveInDirection8(ref drawOffset, CharDir, ((totalActionTime.Ticks - hit_point) - (ActionTime.Ticks - hit_point)) * farthest_distance / (totalActionTime.Ticks - hit_point)); } } } else if (CurrentAction == ActionType.SpAttack) { CharFrameType = FrameType.SpAttack; int totalFrames = TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(CharFrameType, CharDir); CharFrame = (ActionTime.Ticks * totalFrames / totalActionTime.Ticks); } else if (CurrentAction == ActionType.SpAttackShoot) { CharFrameType = FrameType.SpAttackShoot; int totalFrames = TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(CharFrameType, CharDir); CharFrame = (ActionTime.Ticks * totalFrames / totalActionTime.Ticks); if (!MoveInPlace) { int pullback_distance = TextureManager.TILE_SIZE / 8; int farthest_distance = TextureManager.TILE_SIZE / 8; int hold_point = totalActionTime.Ticks / 8; int rush_point = totalActionTime.Ticks * 3 / 8; int hit_point = totalActionTime.Ticks * 4 / 8; int return_point = totalActionTime.Ticks * 7 / 8; if (ActionTime.Ticks <= hold_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, -ActionTime.Ticks * pullback_distance / rush_point); } else if (ActionTime.Ticks <= rush_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, -pullback_distance); } else if (ActionTime.Ticks <= hit_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, (ActionTime.Ticks - rush_point) * (farthest_distance + pullback_distance) / (hit_point - rush_point) - pullback_distance); } else if (ActionTime.Ticks <= return_point) { Operations.MoveInDirection8(ref drawOffset, CharDir, farthest_distance); } else { Operations.MoveInDirection8(ref drawOffset, CharDir, ((totalActionTime.Ticks - hit_point) - (ActionTime.Ticks - hit_point)) * farthest_distance / (totalActionTime.Ticks - hit_point)); } } } else if (CurrentAction == ActionType.SpAttackCharge) { CharFrameType = FrameType.SpAttackCharge; int totalFrames = TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(CharFrameType, CharDir); if (totalFrames > 0) { CharFrame = totalFrames - 1; } if (!MoveInPlace) { if (ActionTime.Ticks / 40 % 2 == 0) { Operations.MoveInDirection8(ref drawOffset, Operations.AddDir(CharDir, Direction8.Left), 1); } } } else if (CurrentAction == ActionType.Sleeping) { CharFrameType = FrameType.Sleep; int frameCount = TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(CharFrameType, Direction8.Down); CharFrame = (ActionTime.Ticks * frameCount / totalActionTime.Ticks); } else if (CurrentAction == ActionType.Hurt) { CharFrameType = FrameType.Hurt; CharFrame = 0; if (!MoveInPlace) { if ((ActionTime.Ticks * 3 / totalActionTime.Ticks) % 2 == 0) { Operations.MoveInDirection8(ref drawOffset, Operations.ReverseDir(CharDir), 1); } } } else if (CurrentAction == ActionType.Defeated) { CharFrameType = FrameType.Hurt; CharFrame = 0; if ((ActionTime.Ticks * 6 / totalActionTime.Ticks) % 2 == 0) { Operations.MoveInDirection8(ref drawOffset, Operations.ReverseDir(CharDir), 1); } if ((ActionTime.Ticks * 2 / totalActionTime.Ticks) > 0) { opacity = 128; } } //else if (CurrentAction == ActionType.Jump) //{ // CharFrame = (ActionTime * TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(FrameType.AltAttack, CharDir) / FrameLength); // if (ActionData1 > 1 || ActionData1 == 0) // { // Operations.MoveInDirection8(ref tileOffset, CharDir, ActionTime * ActionData1 * Graphics.TextureManager.TILE_SIZE / FrameLength); // } // else // { // int moveDist = ActionTime * 2 * Graphics.TextureManager.TILE_SIZE / FrameLength; // if (moveDist > Graphics.TextureManager.TILE_SIZE) moveDist = Graphics.TextureManager.TILE_SIZE; // Operations.MoveInDirection8(ref tileOffset, CharDir, moveDist); // } //} //else if (CurrentAction == ActionType.JumpHit) //{ // int phaseTotal = (FrameLength / 2); // int phaseTime = ActionTime % phaseTotal; // if (ActionTime < FrameLength / 2) // { // CharFrame = (phaseTime * TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(FrameType.AltAttack, CharDir) / phaseTotal); // if (ActionData1 > 1 || ActionData1 == 0) // { // Operations.MoveInDirection8(ref drawOffset, CharDir, phaseTime * ActionData1 * Graphics.TextureManager.TILE_SIZE / phaseTotal); // } // else // { // int moveDist = phaseTime * 2 * Graphics.TextureManager.TILE_SIZE / phaseTotal; // if (moveDist > Graphics.TextureManager.TILE_SIZE) moveDist = Graphics.TextureManager.TILE_SIZE; // Operations.MoveInDirection8(ref drawOffset, CharDir, moveDist); // } // MapHeight = phaseTime * Graphics.TextureManager.TILE_SIZE / phaseTotal; // } // else // { // CharFrame = (phaseTime * TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).FrameData.GetFrameCount(FrameType.AltAttack, CharDir) / phaseTotal); // Operations.MoveInDirection8(ref drawOffset, CharDir, ActionData1 * Graphics.TextureManager.TILE_SIZE - phaseTime * ActionData1 * Graphics.TextureManager.TILE_SIZE / phaseTotal); // MapHeight = (phaseTotal - phaseTime) * Graphics.TextureManager.TILE_SIZE / phaseTotal; // } //} else if (CurrentAction == ActionType.Deflect) { CharFrameType = FrameType.Hurt; CharFrame = 0; TileOffset = new Loc2D(); Operations.MoveInDirection8(ref TileOffset, CharDir, ActionTime.Ticks * Graphics.TextureManager.TILE_SIZE / totalActionTime.Ticks); MapHeight = DrawHelper.GetArc(TextureManager.TILE_SIZE / 2, totalActionTime.Ticks, ActionTime.Ticks); } else if (CurrentAction == ActionType.Knockback) { CharFrameType = FrameType.Hurt; CharFrame = 0; TileOffset = new Loc2D(); Operations.MoveInDirection8(ref TileOffset, Operations.ReverseDir(CharDir), ActionTime.Ticks * TextureManager.TILE_SIZE / totalActionTime.Ticks); MapHeight = 0; } else { CharFrameType = FrameType.Idle; CharFrame = 0; TileOffset = new Loc2D(); MapHeight = 0; } }
private List <PathTile> GetValidNeighbors(Loc2D loc, PathTile[,] tileMap, Loc2D offset, Loc2D mapEnd, bool inAir) { List <PathTile> candidates = new List <PathTile>(); //get all tiles not blocked, or out of range for (int i = 0; i < 8; i++) { Loc2D newLoc = loc; Operations.MoveInDirection8(ref newLoc, (Direction8)i, 1); if (newLoc == mapEnd || Operations.IsInBound(tileMap.GetLength(0), tileMap.GetLength(1), newLoc.X, newLoc.Y) && !Processor.DirBlocked((Direction8)i, ControlledChar, loc + offset, false, 1)) { candidates.Add(tileMap[newLoc.X, newLoc.Y]); } } return(candidates); }
public void Draw() { //draw back status TextureManager.TextureProgram.PushModelView(); Loc2D drawLoc = GetStart(); TextureManager.TextureProgram.LeftMultModelView(Matrix4.CreateTranslation(drawLoc.X, drawLoc.Y, 0)); TextureManager.TextureProgram.UpdateModelView(); int curFrame = CharFrame; if (MovementSpeed < 0) { TextureManager.TextureProgram.SetTextureColor(new Color4(128, 128, 255, opacity)); } else if (MovementSpeed > 0) { TextureManager.TextureProgram.SetTextureColor(new Color4(255, 128, 128, opacity)); } else { TextureManager.TextureProgram.SetTextureColor(new Color4(255, 255, 255, opacity)); } //draw sprite at current frame if (StatusAilment == Enums.StatusAilment.Freeze) { TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).GetSheet(FrameType.Hurt, CharDir).RenderTile(0, 0); } else { TextureManager.GetSpriteSheet(CharData.Species, CharData.Form, CharData.Shiny, CharData.Gender).GetSheet(CharFrameType, CharDir).RenderTile(CharFrame, 0); } TextureManager.TextureProgram.SetTextureColor(new Color4(255, 255, 255, 255)); TextureManager.TextureProgram.PopModelView(); //draw front status if (StatusAilment == Enums.StatusAilment.Burn) { TextureManager.TextureProgram.PushModelView(); //draw front status; use global time Loc2D frontDraw = new Loc2D(CharLoc.X * TextureManager.TILE_SIZE + TileOffset.X + TextureManager.TILE_SIZE / 2 - TextureManager.GetStatusSheet(1).TileWidth / 2, CharLoc.Y * TextureManager.TILE_SIZE + TileOffset.Y - MapHeight + TextureManager.TILE_SIZE - TextureManager.GetStatusSheet(1).TileHeight); TextureManager.TextureProgram.LeftMultModelView(Matrix4.CreateTranslation(frontDraw.X, frontDraw.Y, 0)); TextureManager.TextureProgram.UpdateModelView(); int frame = (int)(Screen.TotalTick / (ulong)STATUS_FRAME_LENGTH.Ticks % (ulong)TextureManager.GetStatusSheet(1).MaxX); TextureManager.GetStatusSheet(1).RenderTile(frame, 0); TextureManager.TextureProgram.PopModelView(); } else if (StatusAilment == Enums.StatusAilment.Freeze) { TextureManager.TextureProgram.PushModelView(); //draw front status; use global time Loc2D frontDraw = new Loc2D(CharLoc.X * TextureManager.TILE_SIZE + TileOffset.X + TextureManager.TILE_SIZE / 2 - TextureManager.GetStatusSheet(0).TileWidth / 2, CharLoc.Y * TextureManager.TILE_SIZE + TileOffset.Y - MapHeight + TextureManager.TILE_SIZE - TextureManager.GetStatusSheet(0).TileHeight); TextureManager.TextureProgram.LeftMultModelView(Matrix4.CreateTranslation(frontDraw.X, frontDraw.Y, 0)); TextureManager.TextureProgram.UpdateModelView(); int frame = (int)(Screen.TotalTick / (ulong)STATUS_FRAME_LENGTH.Ticks % (ulong)TextureManager.GetStatusSheet(0).MaxX); Graphics.TextureManager.GetStatusSheet(0).RenderTile(frame, 0); TextureManager.TextureProgram.PopModelView(); } else if (StatusAilment == Enums.StatusAilment.Poison) { TextureManager.TextureProgram.PushModelView(); //draw front status; use global time Loc2D frontDraw = new Loc2D(CharLoc.X * TextureManager.TILE_SIZE + TileOffset.X + TextureManager.TILE_SIZE / 2 - TextureManager.GetStatusSheet(2).TileWidth / 2, CharLoc.Y * TextureManager.TILE_SIZE + TileOffset.Y - MapHeight + TextureManager.TILE_SIZE - TextureManager.GetStatusSheet(2).TileHeight); TextureManager.TextureProgram.LeftMultModelView(Matrix4.CreateTranslation(frontDraw.X, frontDraw.Y, 0)); TextureManager.TextureProgram.UpdateModelView(); int frame = (int)(Screen.TotalTick / (ulong)STATUS_FRAME_LENGTH.Ticks % (ulong)TextureManager.GetStatusSheet(2).MaxX); Graphics.TextureManager.GetStatusSheet(2).RenderTile(frame, 0); TextureManager.TextureProgram.PopModelView(); } }
private List <Direction8> FindPathToTarget(Loc2D end, bool inAir) { PathTile[,] tileMap = GetSeenTiles(); Loc2D mapStart = new Loc2D(tileMap.GetLength(0) / 2, tileMap.GetLength(1) / 2); Loc2D offset = ControlledChar.CharLoc - mapStart; Loc2D mapEnd = end - offset; List <PathTile> candidates = new List <PathTile>(); tileMap[mapStart.X, mapStart.Y].Heuristic = Math.Sqrt(Math.Pow(mapEnd.X - mapStart.X, 2) + Math.Pow(mapEnd.Y - mapStart.Y, 2)); candidates.Add(tileMap[mapStart.X, mapStart.Y]); while (candidates.Count > 0) { PathTile currentTile = candidates[0]; if (currentTile.Location == mapEnd) { List <Direction8> directions = new List <Direction8>(); TraceBack(directions, currentTile); return(directions); } candidates.RemoveAt(0); currentTile.Traversed = true; List <PathTile> neighbors = GetValidNeighbors(currentTile.Location, tileMap, offset, mapEnd, inAir); //insert each neighbor at the right place foreach (PathTile tile in neighbors) { double newCost = currentTile.Cost + 1; if (tile.Traversed && newCost >= tile.Cost) { //not worth it } else if (!candidates.Contains(tile) || newCost < tile.Cost) { tile.Heuristic = Math.Sqrt(Math.Pow(mapEnd.X - tile.Location.X, 2) + Math.Pow(mapEnd.Y - tile.Location.Y, 2)); tile.BackReference = currentTile; bool placed = false; for (int i = candidates.Count - 1; i >= 0; i--) { if (tile.Cost + tile.Heuristic >= candidates[i].Cost + candidates[i].Heuristic) { candidates.Insert(i + 1, tile); placed = true; break; } else if (candidates[i] == tile) { candidates.RemoveAt(i); } } if (!placed) { candidates.Insert(0, tile); } } } } return(new List <Direction8>()); }
public PlayerSprite(Loc2D charLoc, Direction8 charDir, Gameplay.FormData data) : base(charLoc, charDir) { CharData = data; }
//float scale; //float scaleSpeed; //float rotation; //float rotationSpeed; public ParticleAnimation(int animationIndex, RenderTime frameLength, Loc2D newPosition, Loc2D newSpeed, Loc2D newAcceleration, Color4 newAlpha, Color4 newAlphaSpeed, RenderTime newMaxTime) { AnimationIndex = animationIndex; FrameLength = frameLength; MapLoc = newPosition; StartLoc = MapLoc; Speed = newSpeed; StartSpeed = Speed; Acceleration = newAcceleration; Color = newAlpha; ColorChange = newAlphaSpeed; TotalTime = newMaxTime; }
//an initial create-map method public override void Generate(int seed, RDungeonFloor entry, List <FloorBorder> floorBorders, Dictionary <int, List <int> > borderLinks) { //TODO: make sure that this algorithm follows floorBorders and borderLinks constraints this.seed = seed; this.entry = entry; FloorBorders = floorBorders; BorderLinks = borderLinks; BorderPoints = new Loc2D[floorBorders.Count]; rand = new Random(seed); MapArray = new Tile[entry.FloorSettings["CellX"] * entry.FloorSettings["CellWidth"] + 2, entry.FloorSettings["CellY"] * entry.FloorSettings["CellHeight"] + 2]; GridArray = new GridType[entry.FloorSettings["CellX"] * entry.FloorSettings["CellWidth"] + 2, entry.FloorSettings["CellY"] * entry.FloorSettings["CellHeight"] + 2]; Rooms = new DungeonArrayRoom[entry.FloorSettings["CellX"], entry.FloorSettings["CellY"]]; //array of all rooms VHalls = new DungeonArrayHall[entry.FloorSettings["CellX"], entry.FloorSettings["CellY"] - 1]; //vertical halls HHalls = new DungeonArrayHall[entry.FloorSettings["CellX"] - 1, entry.FloorSettings["CellY"]]; //horizontal halls StartRoom = new Loc2D(-1, -1); //marks spawn point bool isDone; // bool used for various purposes //initialize map array to empty for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { GridArray[x, y] = GridType.Blocked; } } //initialize all rooms+halls to closed by default for (int x = 0; x < entry.FloorSettings["CellX"]; x++) { for (int y = 0; y < entry.FloorSettings["CellY"]; y++) { Rooms[x, y] = new DungeonArrayRoom(); } } for (int x = 0; x < entry.FloorSettings["CellX"]; x++) { for (int y = 0; y < entry.FloorSettings["CellY"] - 1; y++) { VHalls[x, y] = new DungeonArrayHall(); } } for (int x = 0; x < entry.FloorSettings["CellX"] - 1; x++) { for (int y = 0; y < entry.FloorSettings["CellY"]; y++) { HHalls[x, y] = new DungeonArrayHall(); } } // path generation algorithm StartRoom = new Loc2D(rand.Next(0, entry.FloorSettings["CellX"]), rand.Next(0, entry.FloorSettings["CellY"])); // randomly determine start room Loc2D wanderer = StartRoom; int pathsMade = 0; int pathsNeeded = rand.Next(0, 6) + 5; // magic numbers, determine what the dungeon looks like (in general, paths) Direction4 prevDir = Direction4.None; // direction of movement do { if (rand.Next(0, (2 + pathsMade)) == 0) //will end the current path and start a new one from the start { if (rand.Next(0, 2) == 0) //determine if the room should be open or a hall { Rooms[wanderer.X, wanderer.Y].Opened = DungeonArrayRoom.RoomState.Open; } else { Rooms[wanderer.X, wanderer.Y].Opened = DungeonArrayRoom.RoomState.Hall; } pathsMade++; wanderer = StartRoom; prevDir = Direction4.None; } else { bool working = true; do { Loc2D sample = wanderer; Direction4 nextDir = (Direction4)rand.Next(0, 4); if (nextDir != prevDir) //makes sure there is no backtracking { Operations.MoveInDirection4(ref sample, nextDir, 1); prevDir = Operations.ReverseDir(nextDir); if (sample.X >= 0 && sample.X < entry.FloorSettings["CellX"] && sample.Y >= 0 && sample.Y < entry.FloorSettings["CellY"]) // a is the room to be checked after making a move between rooms { openHallBetween(wanderer, sample); wanderer = sample; working = false; } } else { prevDir = Direction4.None; } } while (working); if (rand.Next(0, 2) == 0) //determine if the room should be open or a hall { Rooms[wanderer.X, wanderer.Y].Opened = DungeonArrayRoom.RoomState.Open; } else { Rooms[wanderer.X, wanderer.Y].Opened = DungeonArrayRoom.RoomState.Hall; } } } while (pathsMade < pathsNeeded); Rooms[StartRoom.X, StartRoom.Y].Opened = DungeonArrayRoom.RoomState.Open; //Determine key rooms isDone = false; do //determine ending room randomly { int x = rand.Next(0, Rooms.GetLength(0)); int y = rand.Next(0, Rooms.GetLength(1)); if (Rooms[x, y].Opened == DungeonArrayRoom.RoomState.Open) { EndRoom = new Loc2D(x, y); isDone = true; } } while (!isDone); StartRoom = new Loc2D(-1, -1); isDone = false; do //determine starting room randomly { int x = rand.Next(0, Rooms.GetLength(0)); int y = rand.Next(0, Rooms.GetLength(1)); if (Rooms[x, y].Opened == DungeonArrayRoom.RoomState.Open) { StartRoom = new Loc2D(x, y); isDone = true; } } while (!isDone); // begin part 2, creating ASCII map //create rooms for (int i = 0; i < Rooms.GetLength(0); i++) { for (int j = 0; j < Rooms.GetLength(1); j++) { if (Rooms[i, j].Opened != DungeonArrayRoom.RoomState.Closed) { createRoom(i, j); } } } for (int i = 0; i < Rooms.GetLength(0); i++) { for (int j = 0; j < Rooms.GetLength(1); j++) { if (Rooms[i, j].Opened != DungeonArrayRoom.RoomState.Closed) { drawRoom(i, j); } } } for (int i = 0; i < Rooms.GetLength(0); i++) { for (int j = 0; j < Rooms.GetLength(1); j++) { if (Rooms[i, j].Opened != DungeonArrayRoom.RoomState.Closed) { padSingleRoom(i, j); } } } for (int i = 0; i < VHalls.GetLength(0); i++) { for (int j = 0; j < VHalls.GetLength(1); j++) { if (VHalls[i, j].Open) { createVHall(i, j); } } } for (int i = 0; i < HHalls.GetLength(0); i++) { for (int j = 0; j < HHalls.GetLength(1); j++) { if (HHalls[i, j].Open) { createHHall(i, j); } } } for (int i = 0; i < VHalls.GetLength(0); i++) { for (int j = 0; j < VHalls.GetLength(1); j++) { if (VHalls[i, j].Open) { DrawHalls(VHalls[i, j]); } } } for (int i = 0; i < HHalls.GetLength(0); i++) { for (int j = 0; j < HHalls.GetLength(1); j++) { if (HHalls[i, j].Open) { DrawHalls(HHalls[i, j]); } } } addSEpos(StartRoom, true); addSEpos(EndRoom, false); //texturing MapLayer ground = new MapLayer(Width, Height); GroundLayers.Add(ground); for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { if (GridArray[x, y] == GridType.End) { MapArray[x, y] = new Tile(PMDToolkit.Enums.TileType.ChangeFloor, 1, 0, 0); GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(47, 0), 0); } else if (GridArray[x, y] == GridType.Blocked) { MapArray[x, y] = new Tile(PMDToolkit.Enums.TileType.Blocked, 0, 0, 0); bool[] blockedDirs = new bool[8]; for (int n = 0; n < 8; n++) { blockedDirs[n] = IsBlocked(x, y, (Direction8)n); } if (blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 0; if (!blockedDirs[(int)Direction8.DownLeft]) { layer += 8 * 2; } if (!blockedDirs[(int)Direction8.UpLeft]) { layer += 1; } if (!blockedDirs[(int)Direction8.UpRight]) { layer += 8; } if (!blockedDirs[(int)Direction8.DownRight]) { layer += 2; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (!blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 6; if (blockedDirs[(int)Direction8.UpRight]) { layer += 1 * 8; } if (blockedDirs[(int)Direction8.UpLeft]) { layer += 2 * 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 7; if (blockedDirs[(int)Direction8.DownRight]) { layer += 1 * 8; } if (blockedDirs[(int)Direction8.UpRight]) { layer += 2 * 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 4; if (blockedDirs[(int)Direction8.DownLeft]) { layer += 1 * 8; } if (blockedDirs[(int)Direction8.DownRight]) { layer += 2 * 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { int layer = 5; if (blockedDirs[(int)Direction8.UpLeft]) { layer += 1 * 8; } if (blockedDirs[(int)Direction8.DownLeft]) { layer += 2 * 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (!blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 34; if (blockedDirs[(int)Direction8.UpRight]) { layer += 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 35; if (blockedDirs[(int)Direction8.DownRight]) { layer += 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { int layer = 32; if (blockedDirs[(int)Direction8.DownLeft]) { layer += 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (!blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { int layer = 33; if (blockedDirs[(int)Direction8.UpLeft]) { layer += 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(36, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(37, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(38, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(39, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(44, 0), 0); } else if (blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(45, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(46, 0), 0); } } else { MapArray[x, y] = new Tile(PMDToolkit.Enums.TileType.Walkable, 0, 0, 0); GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(47, 0), 0); } } } GenItems(); SpawnNpcs(); }
public Loc2D(Loc2D loc) { X = loc.X; Y = loc.Y; }