diff --git a/DungeonShooting_Godot/prefab/role/Player.tscn b/DungeonShooting_Godot/prefab/role/Player.tscn index d1bea43..c107fcc 100644 --- a/DungeonShooting_Godot/prefab/role/Player.tscn +++ b/DungeonShooting_Godot/prefab/role/Player.tscn @@ -98,5 +98,4 @@ playing = true [node name="Collision" parent="." index="3"] -position = Vector2( 0, -3 ) shape = SubResource( 32 ) diff --git a/DungeonShooting_Godot/scene/Main.tscn b/DungeonShooting_Godot/scene/Main.tscn index 35a4274..e6534d4 100644 --- a/DungeonShooting_Godot/scene/Main.tscn +++ b/DungeonShooting_Godot/scene/Main.tscn @@ -51,7 +51,6 @@ own_world = true transparent_bg = true handle_input_locally = false -debanding = true render_target_update_mode = 3 [node name="Room" parent="ViewCanvas/ViewportContainer/Viewport" instance=ExtResource( 1 )] diff --git a/DungeonShooting_Godot/scene/Room.tscn b/DungeonShooting_Godot/scene/Room.tscn index aace2c2..4b0daa3 100644 --- a/DungeonShooting_Godot/scene/Room.tscn +++ b/DungeonShooting_Godot/scene/Room.tscn @@ -22,6 +22,10 @@ [node name="dungeon_test" parent="MapRoot" instance=ExtResource( 1 )] +[node name="Wall" parent="MapRoot/dungeon_test" index="0"] +cell_y_sort = false +bake_navigation = true + [node name="Camera2D" type="Camera2D" parent="."] position = Vector2( 253, 219 ) current = true @@ -32,3 +36,5 @@ [node name="ObjectRoot" type="Node2D" parent="."] [node name="SortRoot" type="YSort" parent="."] + +[editable path="MapRoot/dungeon_test"] diff --git a/DungeonShooting_Godot/src/game/GameConfig.cs b/DungeonShooting_Godot/src/game/GameConfig.cs index 22ce9d0..a303d3a 100644 --- a/DungeonShooting_Godot/src/game/GameConfig.cs +++ b/DungeonShooting_Godot/src/game/GameConfig.cs @@ -20,4 +20,8 @@ /// public static readonly Vector2 ViewportSize = new Vector2(480, 270); //public static Vector2 ViewportSize => OS.WindowSize / WindowScale; + /// + /// 游戏地图网格大小 + /// + public static readonly Vector2 MapCellSize = new Vector2(16, 16); } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs index 44de124..c4879b3 100644 --- a/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs @@ -920,7 +920,7 @@ var xf = 30; var yf = Utils.RandRangeInt(60, 120); var rotate = Utils.RandRangeInt(-180, 180); - Throw(new Vector2(30, 15), master.MountPoint.GlobalPosition, startHeight, direction, xf, yf, rotate, true); + Throw(new Vector2(30, 15), master.GlobalPosition, startHeight, direction, xf, yf, rotate, true); } protected override void OnThrowOver() diff --git a/DungeonShooting_Godot/src/game/room/RoomManager.cs b/DungeonShooting_Godot/src/game/room/RoomManager.cs index 2a20736..dfa647d 100644 --- a/DungeonShooting_Godot/src/game/room/RoomManager.cs +++ b/DungeonShooting_Godot/src/game/room/RoomManager.cs @@ -39,6 +39,7 @@ //导航区域数据 private List _polygonDataList = new List(); + private TileMap _groundTiled; private TileMap _tileMap; public override void _EnterTree() @@ -70,7 +71,17 @@ public override void _Ready() { + _tileMap.CellYSort = false; + _tileMap.BakeNavigation = false; + //拆分 ground 和 面向下方的 wall + _groundTiled = new TileMap(); + _groundTiled.CellSize = GameConfig.MapCellSize; + _groundTiled.TileSet = _tileMap.TileSet; + //_groundTiled.SetCell(0, 0, 1); + _mapRoot.AddChild(_groundTiled); + var nowTicks = DateTime.Now.Ticks; + //生成寻路网格 GenerateNavigationPolygon(); GD.Print("计算NavigationPolygon用时: " + (DateTime.Now.Ticks - nowTicks) / 10000 + "毫秒");