internal void Move(int dx, int dy) { if (this != Rogue.GameWorld.Player) { if (dx == 0 && dy == -1) { if (Fighter.Direction != 0) { Fighter.Direction = 0; return; } } if (dx == -1 && dy == 0) { if (Fighter.Direction != 90) { Fighter.Direction = 90; return; } } if (dx == 0 && dy == 1) { if (Fighter.Direction != 180) { Fighter.Direction = 180; return; } } if (dx == 1 && dy == 0) { if (Fighter.Direction != 270) { Fighter.Direction = 270; return; } } } if (!GameMap.Blocked(X + dx, Y + dy)) { if (this == Rogue.GameWorld.Player || FoV.InFov(Rogue.GameWorld.Player.X, Rogue.GameWorld.Player.Y, X, Y, Rogue.GameWorld.Player)) { if (dx == 1 || dx == -1) { for (int x = 0; x < 64 / Constants.MoveSmoothSteps; x++) { OffsetX += Constants.MoveSmoothSteps * dx; if (this != Rogue.GameWorld.Player) { Rendering.RenderAll(this); Draw("white", true); Terminal.Refresh(); } else { Rendering.RenderAll(); } } OffsetX = 0; } if (dy == 1 || dy == -1) { for (int x = 0; x < 64 / Constants.MoveSmoothSteps; x++) { OffsetY += Constants.MoveSmoothSteps * dy; if (this != Rogue.GameWorld.Player) { Rendering.RenderAll(this); Draw("white", true); Terminal.Refresh(); } else { Rendering.RenderAll(); } } OffsetY = 0; } if (this == Rogue.GameWorld.Player) { Camera.HandleMoveCamera(dx, dy); } } X += dx; Y += dy; } }
private static void ThrowingAnimation(GameObject obj, GameObject user) { for (int times = 0; times < Constants.SpellRange; times++) { if (user.Fighter.Direction == 90 || user.Fighter.Direction == 270) { int dx = user.Fighter.Direction == 90 ? -1 : 1; if (GameMap.MapBlocked(obj.X + dx, obj.Y)) { break; } if (CommonMethods.TargetInCoordinate(obj.X, obj.Y)) { break; } for (int x = 0; x < 64 / Constants.MoveSmoothSteps; x++) { Rendering.RenderAll(obj); obj.OffsetX += Constants.MoveSmoothSteps * dx; if (GameMap.MapExplored(obj.X + dx, obj.Y) || FoV.InFov(user.X, user.Y, obj.X + dx, obj.Y, user)) { obj.Draw("white", true); } Terminal.Refresh(); } obj.X += dx; obj.OffsetX = 0; } else if (user.Fighter.Direction == 0 || user.Fighter.Direction == 180) { int dy = user.Fighter.Direction == 0 ? -1 : 1; if (GameMap.MapBlocked(obj.X, obj.Y + dy)) { break; } if (CommonMethods.TargetInCoordinate(obj.X, obj.Y)) { break; } for (int x = 0; x < 64 / Constants.MoveSmoothSteps; x++) { Rendering.RenderAll(obj); obj.OffsetY += Constants.MoveSmoothSteps * dy; if (GameMap.MapExplored(obj.X, obj.Y + dy) || FoV.InFov(user.X, user.Y, obj.X, obj.Y + dy, user)) { obj.Draw("white", true); } Terminal.Refresh(); } obj.Y += dy; obj.OffsetY = 0; } } }