From 4cb902053d9f633bb2934feaadffceac48a93677 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 4 Mar 2024 08:25:41 +0100 Subject: [PATCH] Camera 2D --- Scenes/CameraController.gd | 104 ++++++++++ Scenes/CameraTarget.gd | 8 + Scenes/PixelPerfectRendering.gd | 7 + Scenes/SubViewportSprite.gd | 18 ++ Scenes/game.gd | 12 ++ Scenes/game.tscn | 32 +++ Scenes/player.tscn | 35 ++-- Scenes/test.tscn | 10 +- addons/smoothing/LICENSE | 21 ++ addons/smoothing/plugin.cfg | 7 + addons/smoothing/smoothing.gd | 235 +++++++++++++++++++++++ addons/smoothing/smoothing.png | 3 + addons/smoothing/smoothing.png.import | 34 ++++ addons/smoothing/smoothing_2d.gd | 218 +++++++++++++++++++++ addons/smoothing/smoothing_2d.png | 3 + addons/smoothing/smoothing_2d.png.import | 34 ++++ addons/smoothing/smoothing_plugin.gd | 17 ++ project.godot | 17 +- 18 files changed, 791 insertions(+), 24 deletions(-) create mode 100644 Scenes/CameraController.gd create mode 100644 Scenes/CameraTarget.gd create mode 100644 Scenes/PixelPerfectRendering.gd create mode 100644 Scenes/SubViewportSprite.gd create mode 100644 Scenes/game.gd create mode 100644 Scenes/game.tscn create mode 100644 addons/smoothing/LICENSE create mode 100644 addons/smoothing/plugin.cfg create mode 100644 addons/smoothing/smoothing.gd create mode 100644 addons/smoothing/smoothing.png create mode 100644 addons/smoothing/smoothing.png.import create mode 100644 addons/smoothing/smoothing_2d.gd create mode 100644 addons/smoothing/smoothing_2d.png create mode 100644 addons/smoothing/smoothing_2d.png.import create mode 100644 addons/smoothing/smoothing_plugin.gd diff --git a/Scenes/CameraController.gd b/Scenes/CameraController.gd new file mode 100644 index 00000000..13c694d7 --- /dev/null +++ b/Scenes/CameraController.gd @@ -0,0 +1,104 @@ +class_name CameraController +extends Camera2D + +## Whether to use pixel snap. +@export var pixel_snap: bool = true +## Whether camera movement should be smooth. +@export var enable_smoothing: bool = true + +## The current target being followed. +var _active_target: CameraTarget + +var _previous_pixel_snap_delta := Vector2.ZERO +## The current camera velocity, for smooth damping. +var _current_velocity := Vector2.ZERO +## The current exact position of the camera. +var _current_position: Vector2 + + +func _ready() -> void: + # Add to group so we can look it up later. + add_to_group("camera_controllers") + +## Critically damped spring, based on Game Programming Gems 4 Chapter 1.10. https://archive.org/details/game-programming-gems-4/page/95/mode/2up +## Returns a 2-tuple of [next_position, next_velocity]. +func smooth_damp(current: float, target: float, current_velocity: float, smooth_time: float, max_speed: float, delta: float) -> Array[float]: + smooth_time = max(smooth_time, 0.0001) + var omega := 2.0 / smooth_time + + var x := omega * delta + var x_exp := 1.0 / (1.0 + x + 0.48 * x * x + 0.235 * x * x * x) + var change := current - target + var original_target := target + + # Clamp max speed. + var max_change := max_speed * smooth_time + change = clamp(change, -max_change, max_change) + target = current - change + + var temp := (current_velocity + omega * change) * delta + current_velocity = (current_velocity - omega * temp) * x_exp + var output := target + (change + temp) * x_exp + + # Prevent overshooting. + if (original_target - current > 0.0) == (output > original_target): + output = original_target + current_velocity = (output - original_target) / delta + + return [output, current_velocity] + +func _unhandled_input(_event: InputEvent) -> void: + if Input.is_key_pressed(KEY_1): + pixel_snap = not pixel_snap + print("Camera pixel snap: ", pixel_snap) + if Input.is_key_pressed(KEY_2): + enable_smoothing = not enable_smoothing + print("Camera smoothing: ", enable_smoothing) + +# It's important that the camera position gets updated in _process instead of _physics_process, +# since it needs to be dependent on frame rate. +func _process(delta: float) -> void: + # Update position. + var next_position: Vector2 + var target: Vector2 = _active_target.global_position + + if enable_smoothing: + # Handle target movement with smooth_damp. + # Replace this with any smooth follow / lerp of your choosing, but be careful to use `delta` + # properly -- improper use can result in jitter. Don't do lerp(current, target, delta). + var res_x := smooth_damp(_current_position.x, target.x, _current_velocity.x, 0.2, INF, delta) + var res_y := smooth_damp(_current_position.y, target.y, _current_velocity.y, 0.2, INF, delta) + next_position.x = res_x[0] + next_position.y = res_y[0] + _current_velocity.x = res_x[1] + _current_velocity.y = res_y[1] + else: + # Set next camera position to the exact target. + next_position = target + + _current_position = next_position + + if pixel_snap: + # IMPORTANT: perform pixel snap so that the camera movement doesn't interfere with the + # sub-pixel "smooth movement" we do in the shader. + var snapped_position = (next_position + Vector2(0.5, 0.5)).floor() + _previous_pixel_snap_delta = snapped_position - next_position + next_position = snapped_position + else: + _previous_pixel_snap_delta = Vector2.ZERO + + # Set the camera position. + global_position = next_position + # IMPORTANT: Work around godot bug where camera doesn't update immediately: https://github.com/godotengine/godot/issues/74203 + force_update_scroll() + +## Returns the position delta between the pixel-snapped position and the actual controlled camera position. +## If pixel snap is off, returns Zero. +func get_pixel_snap_delta() -> Vector2: + return _previous_pixel_snap_delta + +## Registers a camera target to follow. +func register_target(target: CameraTarget) -> void: + assert(not _active_target) + _active_target = target + _current_position = _active_target.global_position diff --git a/Scenes/CameraTarget.gd b/Scenes/CameraTarget.gd new file mode 100644 index 00000000..10ac48c5 --- /dev/null +++ b/Scenes/CameraTarget.gd @@ -0,0 +1,8 @@ +class_name CameraTarget +extends Node2D + +func _ready() -> void: + # Attempt to register with controller. + var result: Node = get_tree().get_first_node_in_group("camera_controllers") + if result and result is CameraController: + result.register_target(self) diff --git a/Scenes/PixelPerfectRendering.gd b/Scenes/PixelPerfectRendering.gd new file mode 100644 index 00000000..d318987f --- /dev/null +++ b/Scenes/PixelPerfectRendering.gd @@ -0,0 +1,7 @@ +extends Node2D + +@onready var sub_viewport: SubViewport = $SubViewport + +func _unhandled_input(event: InputEvent) -> void: + # SubViewports don't receive input by default, so we have to propagate it. + sub_viewport.push_input(event) diff --git a/Scenes/SubViewportSprite.gd b/Scenes/SubViewportSprite.gd new file mode 100644 index 00000000..8e748e81 --- /dev/null +++ b/Scenes/SubViewportSprite.gd @@ -0,0 +1,18 @@ +extends Sprite2D + +@onready var orig_pos := position + +func _ready() -> void: + # It's important that this script gets processed _after_ the "game scene", which includes the camera controller. + # That is why we have placed it after the SubViewport. While we're at it, we can + # use a larger priority number so that this node gets processed later in the process graph. + process_priority = 1000 + +func _process(_delta: float) -> void: + # Set the pixel snap delta from the camera so that we can have smooth camera movement. + var pixel_snap_delta := Vector2.ZERO + var result: Node = get_tree().get_first_node_in_group("camera_controllers") + if result and result is CameraController: + pixel_snap_delta = result.get_pixel_snap_delta() + # Hard-code scaling ratio of 6 (you'd want to calculate this in a real game). + position = orig_pos + pixel_snap_delta * 6 diff --git a/Scenes/game.gd b/Scenes/game.gd new file mode 100644 index 00000000..8284c38f --- /dev/null +++ b/Scenes/game.gd @@ -0,0 +1,12 @@ +extends Node2D + +## Whether to use the debug player camera for testing. Otherwise, use the CameraController with non-pixel-perfect settings (hard-coded zoom). +@export var use_debug_player_camera: bool = false + +func _ready() -> void: + var camera_controller: CameraController = get_tree().get_first_node_in_group("camera_controllers") + if use_debug_player_camera: + var debug_player_camera: Camera2D = get_tree().get_first_node_in_group("debug_player_camera") + camera_controller.enabled = false + debug_player_camera.zoom = Vector2(1, 1) + debug_player_camera.enabled = true diff --git a/Scenes/game.tscn b/Scenes/game.tscn new file mode 100644 index 00000000..902ca158 --- /dev/null +++ b/Scenes/game.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=6 format=3 uid="uid://cwfaxgr8pgfga"] + +[ext_resource type="Script" path="res://Scenes/game.gd" id="1_s0gpj"] +[ext_resource type="Script" path="res://Scenes/PixelPerfectRendering.gd" id="2_gdejn"] +[ext_resource type="PackedScene" uid="uid://bv451a8wgty4u" path="res://Scenes/test.tscn" id="3_l2ygy"] +[ext_resource type="Script" path="res://Scenes/SubViewportSprite.gd" id="4_adb7a"] + +[sub_resource type="ViewportTexture" id="ViewportTexture_m5h5j"] +viewport_path = NodePath("PixelPerfectRendering/SubViewport") + +[node name="Game" type="Node2D"] +script = ExtResource("1_s0gpj") + +[node name="PixelPerfectRendering" type="Node2D" parent="."] +editor_description = "The children of this node are responsible for handling pixel-perfect rendering in the game world." +script = ExtResource("2_gdejn") + +[node name="SubViewport" type="SubViewport" parent="PixelPerfectRendering"] +handle_input_locally = false +snap_2d_vertices_to_pixel = true +canvas_item_default_texture_filter = 0 +size = Vector2i(322, 182) +render_target_update_mode = 4 + +[node name="GameScene" parent="PixelPerfectRendering/SubViewport" instance=ExtResource("3_l2ygy")] + +[node name="SubViewportSprite" type="Sprite2D" parent="."] +texture_filter = 1 +position = Vector2(960, 540) +scale = Vector2(6, 6) +texture = SubResource("ViewportTexture_m5h5j") +script = ExtResource("4_adb7a") diff --git a/Scenes/player.tscn b/Scenes/player.tscn index 5941a7a9..1f390991 100644 --- a/Scenes/player.tscn +++ b/Scenes/player.tscn @@ -1,16 +1,18 @@ -[gd_scene load_steps=20 format=3 uid="uid://bghghp5ep4w2j"] +[gd_scene load_steps=22 format=3 uid="uid://bghghp5ep4w2j"] [ext_resource type="Script" path="res://Scripts/PlayerMovement.cs" id="1_m27vu"] [ext_resource type="Texture2D" uid="uid://la06powu57hu" path="res://Sprites/Cirno_Big.png" id="2_bwf6x"] [ext_resource type="PackedScene" uid="uid://b1qnfiuokpvsr" path="res://Scenes/bullet.tscn" id="2_ov36d"] +[ext_resource type="Script" path="res://addons/smoothing/smoothing_2d.gd" id="4_j4xhu"] +[ext_resource type="Script" path="res://Scenes/CameraTarget.gd" id="5_cxvyt"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ai4rh"] +size = Vector2(6, 8) [sub_resource type="AtlasTexture" id="AtlasTexture_omx2u"] atlas = ExtResource("2_bwf6x") region = Rect2(0, 0, 8, 16) -[sub_resource type="RectangleShape2D" id="RectangleShape2D_ai4rh"] -size = Vector2(6, 8) - [sub_resource type="AtlasTexture" id="AtlasTexture_pdst4"] atlas = ExtResource("2_bwf6x") region = Rect2(0, 0, 8, 16) @@ -139,7 +141,19 @@ BulletScene = ExtResource("2_ov36d") Muzzle = NodePath("Muzzle") metadata/_edit_group_ = true -[node name="Sprite2D" type="Sprite2D" parent="."] +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_ai4rh") + +[node name="Muzzle" type="Marker2D" parent="."] +position = Vector2(5, 0) + +[node name="Node2D" type="Node2D" parent="."] + +[node name="Smoothing2D" type="Node2D" parent="."] +script = ExtResource("4_j4xhu") +flags = 55 + +[node name="Sprite2D" type="Sprite2D" parent="Smoothing2D"] visible = false scale = Vector2(2.5, 1.75) texture = SubResource("AtlasTexture_omx2u") @@ -147,15 +161,10 @@ hframes = 3 vframes = 4 frame = 1 -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_ai4rh") +[node name="CameraTarget" type="Node2D" parent="Smoothing2D"] +script = ExtResource("5_cxvyt") -[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Smoothing2D"] y_sort_enabled = true sprite_frames = SubResource("SpriteFrames_q0rt3") animation = &"walk_left" - -[node name="Muzzle" type="Marker2D" parent="."] -position = Vector2(5, 0) - -[node name="Node2D" type="Node2D" parent="."] diff --git a/Scenes/test.tscn b/Scenes/test.tscn index cdd9902e..7cba4375 100644 --- a/Scenes/test.tscn +++ b/Scenes/test.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=8 format=3 uid="uid://bv451a8wgty4u"] +[gd_scene load_steps=9 format=3 uid="uid://bv451a8wgty4u"] [ext_resource type="TileSet" uid="uid://c26fvvju514rc" path="res://Tilesets/test_tileset.tres" id="1_k3ie3"] [ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"] [ext_resource type="PackedScene" uid="uid://cxmcqehjjy82j" path="res://Scenes/reisen.tscn" id="3_8k37m"] [ext_resource type="PackedScene" uid="uid://rp4jhx0tuh24" path="res://Scenes/fragola.tscn" id="4_s7wq6"] [ext_resource type="Texture2D" uid="uid://boi73xiydtslu" path="res://Sprites/MCBlocksBlackOutline.png" id="4_xm6li"] +[ext_resource type="Script" path="res://Scenes/CameraController.gd" id="6_t8ide"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_kegq5"] texture = ExtResource("4_xm6li") @@ -6053,7 +6054,7 @@ format = 2 layer_0/name = "Layer 0" layer_0/y_sort_enabled = true layer_0/navigation_enabled = false -layer_0/tile_data = PackedInt32Array(1572855, 131073, 0, 589817, 1, 0, 655353, 1, 0, 720889, 1, 0, 720890, 1, 0, 786425, 1, 0, 983032, 1, 0, 1048567, 1, 0, 1114103, 1, 0, 1179638, 1, 0, 1114106, 131073, 0, 1179642, 131073, 0, 1245178, 131073, 0, 1179641, 131073, 0, 589813, 1, 0, 655349, 1, 0, 720886, 1, 0, 786421, 1, 0, 720885, 1, 0, 786420, 1, 0, 720884, 1, 0, 655348, 1, 0, 851956, 1, 0, 917492, 1, 0, 851957, 1, 0, 917493, 1, 0, 983029, 1, 0, 983028, 1, 0, 1048564, 1, 0, 262134, 1, 0, 327671, 1, 0, 393207, 1, 0, 458743, 1, 0, 393206, 1, 0, -262148, 131073, 0, -327683, 131073, 0, -393219, 131073, 0, -458754, 131073, 0, -524290, 131073, 0, -589825, 131073, 0, -655361, 131073, 0, -458755, 131073, 0, -393220, 131073, 0, -524291, 131073, 0, -589826, 131073, 0, -655362, 131073, 0, -327684, 131073, 0, -262149, 131073, 0, -196612, 131073, 0, -786432, 1, 0, -720896, 131073, 0, -786431, 1, 0, -655360, 131073, 0, -524289, 131073, 0, -458753, 131073, 0, -393217, 131073, 0, -327681, 131073, 0, -262146, 131073, 0, -196610, 131073, 0, -131075, 131073, 0, -65539, 131073, 0, -131076, 131073, 0, -524288, 131073, 0, -589824, 131073, 0, -655359, 131073, 0, -720895, 131073, 0, -196611, 131073, 0, -262147, 131073, 0, -327682, 131073, 0, -393218, 131073, 0, -589823, 131073, 0, -524287, 131073, 0, -458752, 131073, 0, -393216, 131073, 0, -262145, 131073, 0, -196609, 131073, 0, -131074, 131073, 0, -65538, 131073, 0, -3, 131073, 0, -327680, 131073, 0, -393215, 131073, 0, -458751, 131073, 0, -524286, 131073, 0, -589822, 131073, 0, -655357, 1, 0, -720893, 1, 0, -655356, 1, 0, -589821, 1, 0, -524285, 131073, 0, -262144, 131073, 0, -131073, 131073, 0, 65533, 131073, 0, 131068, 131073, 0, 196604, 131073, 0, 131069, 131073, 0, 65534, 131073, 0, -2, 131073, 0, -65537, 131073, 0, -458750, 1, 0, -458749, 131073, 0, -393213, 131073, 0, -327678, 131073, 0, -262142, 131073, 0, -196607, 131073, 0, -131071, 131073, 0, -65536, 131073, 0, 0, 131073, 0, 131071, 131073, 0, 196607, 131073, 0, 262142, 131073, 0, 327678, 131073, 0, -524284, 1, 0, -589820, 1, 0, -655355, 1, 0, -458748, 1, 0, -393212, 131073, 0, -327677, 131073, 0, -262141, 131073, 0, -196606, 131073, 0, -131070, 131073, 0, -65535, 131073, 0, 1, 131073, 0, 65536, 131073, 0, 131072, 131073, 0, 262143, 131073, 0, 327679, 131073, 0, 393213, 131073, 0, 458749, 131073, 0, 524284, 131073, 0, 393214, 131073, 0, 131073, 131073, 0, 65537, 131073, 0, 2, 131073, 0, -65534, 131073, 0, -131069, 131073, 0, -131068, 131073, 0, -196604, 131073, 0, -262139, 131073, 0, -327675, 131073, 0, -393210, 1, 0, -458746, 1, 0, -65533, 131073, 0, 3, 131073, 0, 65538, 131073, 0, 131074, 131073, 0, 196609, 131073, 0, 262145, 131073, 0, 327680, 131073, 0, 393215, 131073, 0, 458751, 131073, 0, 524286, 131073, 0, 589822, 131073, 0, 458750, 131073, 0, -524283, 1, 0, -589819, 1, 0, -458747, 1, 0, -393211, 131073, 0, -327676, 131073, 0, -262140, 131073, 0, 196608, 131073, 0, 393216, 131073, 0, 524287, 131073, 0, 589823, 131073, 0, 524285, 131073, 0, -196605, 131073, 0, -393214, 131073, 0, -327679, 131073, 0, -262143, 131073, 0, -131072, 131073, 0, -1, 131073, 0, 65535, 131073, 0, 131070, 131073, 0, 196606, 131073, 0, 196605, 131073, 0, 262140, 131073, 0, 327677, 131073, 0, 262141, 131073, 0, -196608, 131073, 0, 262144, 131073, 0, 655359, 131073, 0, 720895, 131073, 0, 786430, 131073, 0, 851966, 131073, 0, 917502, 131073, 0, 851967, 131073, 0, 786431, 131073, 0, 655360, 131073, 0, 589824, 131073, 0, 524289, 131073, 0, 458753, 131073, 0, 393218, 131073, 0, 327682, 131073, 0, 262147, 131073, 0, 196611, 131073, 0, 131076, 131073, 0, 65540, 131073, 0, 5, 131073, 0, -65531, 131073, 0, -131066, 131073, 0, -196602, 131073, 0, -262137, 1, 0, -327674, 1, 0, -393209, 1, 0, -262138, 131073, 0, -196603, 131073, 0, -131067, 131073, 0, -65532, 131073, 0, 4, 131073, 0, 65539, 131073, 0, 131075, 131073, 0, 196610, 131073, 0, 262146, 131073, 0, 327681, 131073, 0, 393217, 131073, 0, 917503, 131073, 0, 786432, 131073, 0, 720896, 131073, 0, 524288, 131073, 0, 458752, 131073, 0, 655361, 131073, 0, 589825, 131073, 0, 524290, 131073, 0, 458754, 131073, 0, 393219, 131073, 0, 458755, 131073, 0, 393220, 131073, 0, 327684, 131073, 0, 262149, 131073, 0, 196613, 131073, 0, 131078, 131073, 0, 65542, 1, 0, 6, 131073, 0, -65530, 131073, 0, -131065, 131073, 0, -196601, 1, 0, 7, 1, 0, 524292, 1, 0, 589827, 1, 0, 655363, 1, 0, 589826, 131073, 0, 655362, 131073, 0, 720897, 131073, 0, 786433, 131073, 0, 851968, 131073, 0, 917504, 131073, 0, 983039, 131073, 0, 1048575, 131073, 0, 1114111, 131073, 0, 1179647, 131073, 0, 1048576, 1, 0, 983040, 1, 0, 1048577, 1, 0, 983041, 1, 0, 917506, 1, 0, 851970, 1, 0, 786435, 1, 0, 720899, 1, 0, 655364, 1, 0, 589828, 1, 0, 458756, 1, 0, 393221, 1, 0, 327685, 131073, 0, 262150, 1, 0, 196614, 1, 0, 131079, 1, 0, 65543, 1, 0, 8, 1, 0, 196615, 1, 0, 262151, 1, 0, 327686, 1, 0, 393222, 1, 0, 458757, 1, 0, 524293, 1, 0, 589829, 1, 0, 655365, 1, 0, 720900, 1, 0, 786436, 1, 0, 851971, 1, 0, 917507, 1, 0, 917508, 1, 0, 851972, 1, 0, 917509, 1, 0, 851973, 1, 0, 786438, 1, 0, 720902, 1, 0, 655366, 1, 0, 589830, 1, 0, 524295, 1, 0, 458759, 1, 0, 393223, 1, 0, 458758, 1, 0, 524294, 1, 0, 720901, 1, 0, 786437, 1, 0, 983044, 1, 0, 131077, 131073, 0, 65541, 131073, 0, 196612, 131073, 0, 262148, 131073, 0, 327683, 131073, 0, 524291, 131073, 0, 720898, 131073, 0, 786434, 131073, 0, 851969, 131073, 0, 917505, 131073, 0, -655358, 131073, 0, -196614, 1, 0, -131078, 1, 0, -65542, 1, 0, -6, 131073, 0, 65530, 1, 0, -7, 1, 0, -65543, 1, 0, -131079, 1, 0, 65529, 1, 0, -720901, 1, 0, -655366, 1, 0, -589829, 1, 0, -524294, 1, 0, -589830, 1, 0, -524295, 1, 0, -655367, 1, 0, -720903, 1, 0, -786439, 1, 0, -851974, 1, 0, -786438, 1, 0, -720902, 1, 0, -917508, 1, 0, -851971, 1, 0, -786436, 1, 0, -1114109, 1, 0, -1048573, 1, 0, -983038, 1, 0, -1048574, 1, 0, -1114110, 1, 0, -1179645, 1, 0, -1114111, 1, 0, -1179647, 1, 0, -1179648, 1, 0, 1114108, 131073, 0, 1048572, 131073, 0, 983037, 131073, 0, 917500, 131073, 0, 851964, 131073, 0, 917499, 131073, 0, 983035, 131073, 0, 1048571, 131073, 0, 917498, 1, 0, 851963, 1, 0, 786427, 131073, 0, 720891, 1, 0, 720892, 131073, 0, 786428, 131073, 0, 983036, 131073, 0, 1048573, 131073, 0, 1114109, 131073, 0, 1179645, 1, 0, 1114110, 131073, 0, 983038, 131073, 0, 917501, 131073, 0, 851965, 131073, 0, 786429, 131073, 0, 720893, 131073, 0, 655357, 131073, 0, 720894, 131073, 0, 655358, 131073, 0, 1048574, 131073, 0, 589821, 131073, 0, 655356, 131073, 0, 589820, 131073, 0, 655355, 131073, 0, 589819, 131073, 0, 524283, 131073, 0, 458747, 131073, 0, 393211, 131073, 0, 458748, 131073, 0, 393212, 131073, 0, 524282, 131073, 0, 458746, 1, 0, 393210, 1, 0, 589818, 1, 0, 655354, 131073, 0, 851962, 1, 0, 524281, 1, 0, 327675, 131073, 0, 262139, 131073, 0, 327676, 131073, 0, 786426, 1, 0, 393209, 1, 0, 524297, 1, 0, 589833, 1, 0, 655370, 1, 0, 720905, 1, 0, 786441, 1, 0, 655369, 1, 0, 589832, 1, 0, 720904, 1, 0, 720903, 1, 0, 655367, 1, 0, 589831, 1, 0, 524296, 1, 0, 655368, 1, 0, 393224, 1, 0, 327688, 1, 0, 458760, 1, 0, 327687, 1, 0, 262152, 1, 0, 196616, 1, 0, 131081, 1, 0, 262153, 1, 0, 327689, 1, 0, 393225, 1, 0, 262154, 1, 0, 196618, 1, 0, 196617, 1, 0, 65544, 1, 0, 131080, 1, 0, 9, 1, 0, -65528, 1, 0, -65529, 1, 0, -262136, 1, 0, -196600, 1, 0, -131064, 1, 0, 65545, 1, 0, 131082, 1, 0, 262155, 1, 0, 327690, 1, 0, -65527, 1, 0, -131063, 1, 0, 10, 1, 0, 65546, 1, 0, 393227, 1, 0, 458762, 1, 0, 524298, 1, 0, 458761, 1, 0, 393226, 1, 0, 327691, 1, 0, 458763, 1, 0, 524299, 1, 0, 589835, 1, 0, 655371, 1, 0, 720907, 1, 0, 786443, 1, 0, 720906, 1, 0, 589834, 1, 0, 786442, 1, 0, 851978, 1, 0, 917514, 1, 0, 983050, 1, 0, 1048586, 1, 0, 1048585, 1, 0, 983049, 1, 0, 917513, 1, 0, 983048, 1, 0, 917512, 1, 0, 851976, 1, 0, 786440, 1, 0, 851977, 1, 0, 983047, 1, 0, 917511, 1, 0, 983046, 1, 0, 1048582, 1, 0, 851975, 1, 0, 851974, 1, 0, 917510, 1, 0, 983045, 1, 0, 1048581, 1, 0, 786439, 1, 0, 1179653, 1, 0, 1114116, 1, 0, 1048580, 1, 0, 983043, 1, 0, 1048579, 1, 0, 1114114, 1, 0, 1048578, 1, 0, 1114113, 1, 0, 983042, 1, 0, 1179650, 1, 0, 1245185, 1, 0, 1179649, 1, 0, 1245184, 1, 0, 1179648, 1, 0, 1114112, 1, 0, 1310719, 1, 0, 1245183, 1, 0, 1310718, 1, 0, 1245182, 1, 0, 1179646, 131073, 0, -65544, 1, 0, -9, 1, 0, 65527, 1, 0, -65545, 1, 0, 131063, 1, 0, 65528, 1, 0, 131064, 1, 0, -8, 1, 0, 131065, 1, 0, 196601, 1, 0, 262137, 1, 0, 327673, 1, 0, 458745, 1, 0, 524280, 1, 0, 589816, 1, 0, 655352, 1, 0, 458744, 1, 0, 393208, 1, 0, 327672, 1, 0, 262135, 1, 0, 262136, 1, 0, 196599, 1, 0, 196600, 1, 0, 524278, 1, 0, 524279, 1, 0, 589815, 1, 0, 655351, 1, 0, 720887, 1, 0, 655350, 1, 0, 720888, 1, 0, 786423, 1, 0, 851960, 1, 0, 917496, 1, 0, 983033, 1, 0, 1048568, 1, 0, 917495, 1, 0, 851961, 1, 0, 786424, 1, 0, 983031, 1, 0, 851959, 1, 0, 786422, 1, 0, 917497, 1, 0, 1048569, 1, 0, 1048570, 131073, 0, 1114105, 1, 0, 983034, 1, 0, 1114104, 1, 0, 917494, 1, 0, 851958, 1, 0, 589814, 1, 0, 458742, 1, 0, 327670, 1, 0, 196598, 1, 0, 131062, 1, 0, -10, 1, 0, -131081, 1, 0, -131080, 1, 0, -196615, 1, 0, 327674, 1, 0, 1179643, 131073, 0, 1114107, 131073, 0, 1245179, 131073, 0, 1310714, 131073, 0, 1376250, 131073, 0, 1310713, 131073, 0, 1245177, 131073, 0, 1310712, 131073, 0, 1245176, 1, 0, 1179639, 1, 0, 1179640, 1, 0, 131066, 131073, 0, 196603, 131073, 0, 262138, 131073, 0, 196602, 1, 0, 65531, 131073, 0, -5, 131073, 0, 65532, 131073, 0, 131067, 131073, 0, -65540, 131073, 0, -4, 131073, 0, -131077, 131073, 0, -65541, 131073, 0, -196613, 131073, 0, 524277, 1, 0, 917491, 1, 0, 393205, 1, 0, 327669, 1, 0, 393204, 1, 0, 262133, 1, 0, 196597, 1, 0, 131061, 1, 0, 65526, 1, 0, -196616, 1, 0, -262152, 1, 0, -327687, 1, 0, -327686, 1, 0, -262151, 1, 0, -262150, 1, 0, -327685, 1, 0, -393221, 1, 0, -458756, 131073, 0, -524292, 131073, 0, -589827, 131073, 0, -655363, 131073, 0, -720898, 131073, 0, -786434, 1, 0, -720897, 1, 0, -786433, 1, 0, -917504, 1, 0, -917505, 1, 0, -851968, 1, 0, -851967, 1, 0, -917502, 1, 0, -851966, 1, 0, -786430, 1, 0, 1048566, 1, 0, 1245175, 1, 0, 1376248, 131073, 0, 1441784, 131073, 0, 1507320, 131073, 0, 1572856, 131073, 0, 1507321, 131073, 0, 1441785, 131073, 0, 1179644, 131073, 0, 1245180, 131073, 0, 1310715, 131073, 0, 1376251, 131073, 0, 1441786, 131073, 0, 1376255, 1, 0, 1310720, 1, 0, 1114115, 1, 0, 1179651, 1, 0, 1245186, 1, 0, 1310722, 1, 0, 1376257, 1, 0, 1441793, 1, 0, 1507328, 1, 0, 1441792, 1, 0, 1376256, 1, 0, 1310721, 1, 0, 1179652, 1, 0, -524281, 1, 0, -458745, 1, 0, -262135, 1, 0, -327672, 1, 0, 1114117, 1, 0, 1114120, 1, 0, 1114121, 1, 0, 393228, 1, 0, 917515, 1, 0, 1048587, 1, 0, -1114112, 1, 0, -1179646, 1, 0, -1179644, 1, 0, -1048575, 1, 0, -983040, 1, 0, -983039, 1, 0, -917503, 1, 0, -851970, 1, 0, -786435, 1, 0, -851972, 1, 0, -983043, 1, 0, -720900, 1, 0, -655365, 1, 0, -851973, 1, 0, -786437, 1, 0, -589831, 1, 0, -458758, 1, 0, -393223, 1, 0, -458759, 1, 0, -524293, 1, 0, -458757, 1, 0, -393222, 1, 0, -589828, 1, 0, -655364, 1, 0, -720899, 1, 0, -327688, 1, 0, -262153, 1, 0, -327689, 1, 0, -393225, 1, 0, -196617, 1, 0, -131082, 1, 0, -65546, 1, 0, -393224, 1, 0, -458760, 1, 0, -524296, 1, 0, 1376249, 131073, 0, 1441783, 131073, 0) +layer_0/tile_data = PackedInt32Array(1572855, 131073, 0, 589817, 1, 0, 655353, 131073, 0, 720889, 131073, 0, 720890, 131073, 0, 786425, 131073, 0, 983032, 131073, 0, 1048567, 131073, 0, 1114103, 131073, 0, 1179638, 131073, 0, 1114106, 196609, 0, 1179642, 131073, 0, 1245178, 131073, 0, 1179641, 196609, 0, 589813, 1, 0, 655349, 1, 0, 720886, 1, 0, 786421, 1, 0, 720885, 1, 0, 786420, 1, 0, 720884, 1, 0, 655348, 1, 0, 851956, 1, 0, 917492, 1, 0, 851957, 1, 0, 917493, 1, 0, 983029, 1, 0, 983028, 1, 0, 1048564, 1, 0, 262134, 1, 0, 327671, 1, 0, 393207, 1, 0, 458743, 1, 0, 393206, 1, 0, -262148, 131073, 0, -327683, 131073, 0, -393219, 131073, 0, -458754, 131073, 0, -524290, 131073, 0, -589825, 131073, 0, -655361, 131073, 0, -458755, 1, 0, -393220, 1, 0, -524291, 1, 0, -589826, 1, 0, -655362, 1, 0, -327684, 1, 0, -262149, 1, 0, -196612, 131073, 0, -786432, 131073, 0, -720896, 131073, 0, -786431, 131073, 0, -655360, 131073, 0, -524289, 131073, 0, -458753, 131073, 0, -393217, 65537, 1, -327681, 65537, 1, -262146, 65537, 1, -196610, 65537, 1, -131075, 65537, 1, -65539, 65537, 1, -131076, 131073, 0, -524288, 65537, 1, -589824, 65537, 1, -655359, 65537, 1, -720895, 131073, 0, -196611, 131073, 0, -262147, 131073, 0, -327682, 131073, 0, -393218, 131073, 0, -589823, 65537, 1, -524287, 131073, 0, -458752, 131073, 0, -393216, 786433, 0, -262145, 786433, 0, -196609, 786433, 0, -131074, 786433, 0, -65538, 851969, 3, -3, 851969, 3, -327680, 851969, 3, -393215, 851969, 3, -458751, 131073, 0, -524286, 65537, 1, -589822, 131073, 0, -655357, 131073, 0, -720893, 1, 0, -655356, 1, 0, -589821, 131073, 0, -524285, 131073, 0, -262144, 851969, 3, -131073, 851969, 3, 65533, 851969, 3, 131068, 786433, 0, 196604, 786433, 0, 131069, 851969, 3, 65534, 851969, 3, -2, 851969, 3, -65537, 851969, 3, -458750, 65537, 1, -458749, 131073, 0, -393213, 65537, 1, -327678, 131073, 0, -262142, 851969, 3, -196607, 851969, 3, -131071, 851969, 3, -65536, 851969, 3, 0, 851969, 3, 131071, 851969, 3, 196607, 851969, 3, 262142, 851969, 3, 327678, 851969, 3, -524284, 131073, 0, -589820, 1, 0, -655355, 1, 0, -458748, 131073, 0, -393212, 131073, 0, -327677, 65537, 1, -262141, 786433, 0, -196606, 851969, 3, -131070, 851969, 3, -65535, 851969, 3, 1, 851969, 3, 65536, 851969, 3, 131072, 851969, 3, 262143, 851969, 3, 327679, 851969, 3, 393213, 786433, 0, 458749, 65537, 1, 524284, 65537, 1, 393214, 851969, 3, 131073, 851969, 3, 65537, 851969, 3, 2, 786433, 0, -65534, 851969, 3, -131069, 851969, 3, -131068, 131073, 0, -196604, 65537, 1, -262139, 131073, 0, -327675, 131073, 0, -393210, 1, 0, -458746, 1, 0, -65533, 851969, 3, 3, 851969, 3, 65538, 851969, 3, 131074, 851969, 3, 196609, 851969, 3, 262145, 851969, 3, 327680, 851969, 3, 393215, 851969, 3, 458751, 851969, 3, 524286, 851969, 3, 589822, 65537, 1, 458750, 851969, 3, -524283, 1, 0, -589819, 1, 0, -458747, 1, 0, -393211, 131073, 0, -327676, 131073, 0, -262140, 65537, 1, 196608, 851969, 3, 393216, 851969, 3, 524287, 851969, 3, 589823, 786433, 0, 524285, 65537, 1, -196605, 786433, 0, -393214, 131073, 0, -327679, 851969, 3, -262143, 851969, 3, -131072, 851969, 3, -1, 851969, 3, 65535, 851969, 3, 131070, 851969, 3, 196606, 851969, 3, 196605, 786433, 0, 262140, 786433, 0, 327677, 786433, 0, 262141, 786433, 0, -196608, 851969, 3, 262144, 851969, 3, 655359, 786433, 0, 720895, 65537, 1, 786430, 65537, 1, 851966, 131073, 0, 917502, 131073, 0, 851967, 65537, 1, 786431, 65537, 1, 655360, 786433, 0, 589824, 851969, 3, 524289, 851969, 3, 458753, 851969, 3, 393218, 786433, 0, 327682, 786433, 0, 262147, 786433, 0, 196611, 786433, 0, 131076, 786433, 0, 65540, 786433, 0, 5, 131073, 0, -65531, 65537, 1, -131066, 131073, 0, -196602, 131073, 0, -262137, 1, 0, -327674, 1, 0, -393209, 1, 0, -262138, 131073, 0, -196603, 131073, 0, -131067, 65537, 1, -65532, 131073, 0, 4, 851969, 3, 65539, 851969, 3, 131075, 851969, 3, 196610, 851969, 3, 262146, 851969, 3, 327681, 851969, 3, 393217, 851969, 3, 917503, 65537, 1, 786432, 65537, 1, 720896, 786433, 0, 524288, 851969, 3, 458752, 851969, 3, 655361, 786433, 0, 589825, 131073, 0, 524290, 786433, 0, 458754, 131073, 0, 393219, 131073, 0, 458755, 65537, 1, 393220, 65537, 1, 327684, 65537, 1, 262149, 65537, 1, 196613, 65537, 1, 131078, 65537, 1, 65542, 65537, 1, 6, 65537, 1, -65530, 131073, 0, -131065, 131073, 0, -196601, 131073, 0, 7, 131073, 0, 524292, 131073, 0, 589827, 131073, 0, 655363, 131073, 0, 589826, 65537, 1, 655362, 65537, 1, 720897, 65537, 1, 786433, 65537, 1, 851968, 65537, 1, 917504, 65537, 1, 983039, 131073, 0, 1048575, 131073, 0, 1114111, 131073, 0, 1179647, 131073, 0, 1048576, 131073, 0, 983040, 131073, 0, 1048577, 131073, 0, 983041, 131073, 0, 917506, 131073, 0, 851970, 131073, 0, 786435, 131073, 0, 720899, 131073, 0, 655364, 131073, 0, 589828, 131073, 0, 458756, 131073, 0, 393221, 131073, 0, 327685, 131073, 0, 262150, 131073, 0, 196614, 131073, 0, 131079, 131073, 0, 65543, 131073, 0, 8, 131073, 0, 196615, 131073, 0, 262151, 131073, 0, 327686, 131073, 0, 393222, 131073, 0, 458757, 131073, 0, 524293, 131073, 0, 589829, 131073, 0, 655365, 131073, 0, 720900, 131073, 0, 786436, 131073, 0, 851971, 131073, 0, 917507, 131073, 0, 917508, 1, 0, 851972, 1, 0, 917509, 1, 0, 851973, 1, 0, 786438, 1, 0, 720902, 1, 0, 655366, 1, 0, 589830, 1, 0, 524295, 1, 0, 458759, 1, 0, 393223, 131073, 0, 458758, 131073, 0, 524294, 131073, 0, 720901, 1, 0, 786437, 1, 0, 983044, 1, 0, 131077, 131073, 0, 65541, 131073, 0, 196612, 131073, 0, 262148, 131073, 0, 327683, 131073, 0, 524291, 65537, 1, 720898, 131073, 0, 786434, 131073, 0, 851969, 131073, 0, 917505, 131073, 0, -655358, 131073, 0, -196614, 1, 0, -131078, 1, 0, -65542, 1, 0, -6, 131073, 0, 65530, 131073, 0, -7, 1, 0, -65543, 1, 0, -131079, 1, 0, 65529, 1, 0, -720901, 1, 0, -655366, 1, 0, -589829, 1, 0, -524294, 1, 0, -589830, 1, 0, -524295, 1, 0, -655367, 1, 0, -720903, 1, 0, -786439, 1, 0, -851974, 1, 0, -786438, 1, 0, -720902, 1, 0, -917508, 1, 0, -851971, 1, 0, -786436, 1, 0, -1114109, 1, 0, -1048573, 1, 0, -983038, 1, 0, -1048574, 1, 0, -1114110, 1, 0, -1179645, 1, 0, -1114111, 1, 0, -1179647, 1, 0, -1179648, 1, 0, 1114108, 131073, 0, 1048572, 131073, 0, 983037, 131073, 0, 917500, 131073, 0, 851964, 196609, 0, 917499, 196609, 0, 983035, 196609, 0, 1048571, 131073, 0, 917498, 196609, 0, 851963, 196609, 0, 786427, 196609, 0, 720891, 131073, 0, 720892, 196609, 0, 786428, 196609, 0, 983036, 131073, 0, 1048573, 131073, 0, 1114109, 131073, 0, 1179645, 1, 0, 1114110, 131073, 0, 983038, 131073, 0, 917501, 131073, 0, 851965, 131073, 0, 786429, 131073, 0, 720893, 196609, 0, 655357, 65537, 1, 720894, 65537, 1, 655358, 65537, 1, 1048574, 131073, 0, 589821, 65537, 1, 655356, 196609, 0, 589820, 131073, 0, 655355, 131073, 0, 589819, 131073, 0, 524283, 131073, 0, 458747, 131073, 0, 393211, 65537, 1, 458748, 65537, 1, 393212, 65537, 1, 524282, 131073, 0, 458746, 131073, 0, 393210, 131073, 0, 589818, 131073, 0, 655354, 131073, 0, 851962, 131073, 0, 524281, 131073, 0, 327675, 65537, 1, 262139, 65537, 1, 327676, 65537, 1, 786426, 131073, 0, 393209, 131073, 0, 524297, 1, 0, 589833, 1, 0, 655370, 1, 0, 720905, 1, 0, 786441, 1, 0, 655369, 1, 0, 589832, 1, 0, 720904, 1, 0, 720903, 1, 0, 655367, 1, 0, 589831, 1, 0, 524296, 1, 0, 655368, 1, 0, 393224, 1, 0, 327688, 1, 0, 458760, 1, 0, 327687, 131073, 0, 262152, 131073, 0, 196616, 131073, 0, 131081, 131073, 0, 262153, 1, 0, 327689, 1, 0, 393225, 1, 0, 262154, 1, 0, 196618, 1, 0, 196617, 1, 0, 65544, 131073, 0, 131080, 131073, 0, 9, 1, 0, -65528, 131073, 0, -65529, 131073, 0, -262136, 1, 0, -196600, 1, 0, -131064, 131073, 0, 65545, 1, 0, 131082, 1, 0, 262155, 1, 0, 327690, 1, 0, -65527, 1, 0, -131063, 1, 0, 10, 1, 0, 65546, 1, 0, 393227, 1, 0, 458762, 1, 0, 524298, 1, 0, 458761, 1, 0, 393226, 1, 0, 327691, 1, 0, 458763, 1, 0, 524299, 1, 0, 589835, 1, 0, 655371, 1, 0, 720907, 1, 0, 786443, 1, 0, 720906, 1, 0, 589834, 1, 0, 786442, 1, 0, 851978, 1, 0, 917514, 1, 0, 983050, 1, 0, 1048586, 1, 0, 1048585, 1, 0, 983049, 1, 0, 917513, 1, 0, 983048, 1, 0, 917512, 1, 0, 851976, 1, 0, 786440, 1, 0, 851977, 1, 0, 983047, 1, 0, 917511, 1, 0, 983046, 1, 0, 1048582, 1, 0, 851975, 1, 0, 851974, 1, 0, 917510, 1, 0, 983045, 1, 0, 1048581, 1, 0, 786439, 1, 0, 1179653, 1, 0, 1114116, 1, 0, 1048580, 1, 0, 983043, 1, 0, 1048579, 1, 0, 1114114, 1, 0, 1048578, 131073, 0, 1114113, 131073, 0, 983042, 131073, 0, 1179650, 1, 0, 1245185, 1, 0, 1179649, 131073, 0, 1245184, 131073, 0, 1179648, 131073, 0, 1114112, 131073, 0, 1310719, 131073, 0, 1245183, 131073, 0, 1310718, 1, 0, 1245182, 1, 0, 1179646, 131073, 0, -65544, 1, 0, -9, 1, 0, 65527, 1, 0, -65545, 1, 0, 131063, 1, 0, 65528, 1, 0, 131064, 1, 0, -8, 1, 0, 131065, 131073, 0, 196601, 131073, 0, 262137, 131073, 0, 327673, 131073, 0, 458745, 131073, 0, 524280, 1, 0, 589816, 1, 0, 655352, 1, 0, 458744, 1, 0, 393208, 131073, 0, 327672, 131073, 0, 262135, 1, 0, 262136, 131073, 0, 196599, 1, 0, 196600, 1, 0, 524278, 1, 0, 524279, 1, 0, 589815, 1, 0, 655351, 1, 0, 720887, 1, 0, 655350, 1, 0, 720888, 1, 0, 786423, 1, 0, 851960, 131073, 0, 917496, 131073, 0, 983033, 131073, 0, 1048568, 131073, 0, 917495, 131073, 0, 851961, 131073, 0, 786424, 131073, 0, 983031, 131073, 0, 851959, 1, 0, 786422, 1, 0, 917497, 131073, 0, 1048569, 196609, 0, 1048570, 196609, 0, 1114105, 196609, 0, 983034, 196609, 0, 1114104, 131073, 0, 917494, 1, 0, 851958, 1, 0, 589814, 1, 0, 458742, 1, 0, 327670, 1, 0, 196598, 1, 0, 131062, 1, 0, -10, 1, 0, -131081, 1, 0, -131080, 1, 0, -196615, 1, 0, 327674, 131073, 0, 1179643, 131073, 0, 1114107, 131073, 0, 1245179, 131073, 0, 1310714, 131073, 0, 1376250, 131073, 0, 1310713, 131073, 0, 1245177, 196609, 0, 1310712, 196609, 0, 1245176, 196609, 0, 1179639, 131073, 0, 1179640, 196609, 0, 131066, 131073, 0, 196603, 65537, 1, 262138, 65537, 1, 196602, 131073, 0, 65531, 131073, 0, -5, 131073, 0, 65532, 65537, 1, 131067, 65537, 1, -65540, 131073, 0, -4, 65537, 1, -131077, 131073, 0, -65541, 131073, 0, -196613, 1, 0, 524277, 1, 0, 917491, 1, 0, 393205, 1, 0, 327669, 1, 0, 393204, 1, 0, 262133, 1, 0, 196597, 1, 0, 131061, 1, 0, 65526, 1, 0, -196616, 1, 0, -262152, 1, 0, -327687, 1, 0, -327686, 1, 0, -262151, 1, 0, -262150, 1, 0, -327685, 1, 0, -393221, 1, 0, -458756, 1, 0, -524292, 1, 0, -589827, 1, 0, -655363, 1, 0, -720898, 1, 0, -786434, 1, 0, -720897, 1, 0, -786433, 1, 0, -917504, 1, 0, -917505, 1, 0, -851968, 131073, 0, -851967, 131073, 0, -917502, 1, 0, -851966, 1, 0, -786430, 131073, 0, 1048566, 131073, 0, 1245175, 131073, 0, 1376248, 196609, 0, 1441784, 131073, 0, 1507320, 131073, 0, 1572856, 131073, 0, 1507321, 131073, 0, 1441785, 131073, 0, 1179644, 131073, 0, 1245180, 131073, 0, 1310715, 131073, 0, 1376251, 131073, 0, 1441786, 131073, 0, 1376255, 1, 0, 1310720, 131073, 0, 1114115, 1, 0, 1179651, 1, 0, 1245186, 1, 0, 1310722, 1, 0, 1376257, 1, 0, 1441793, 1, 0, 1507328, 1, 0, 1441792, 1, 0, 1376256, 1, 0, 1310721, 1, 0, 1179652, 1, 0, -524281, 1, 0, -458745, 1, 0, -262135, 1, 0, -327672, 1, 0, 1114117, 1, 0, 1114120, 1, 0, 1114121, 1, 0, 393228, 1, 0, 917515, 1, 0, 1048587, 1, 0, -1114112, 1, 0, -1179646, 1, 0, -1179644, 1, 0, -1048575, 1, 0, -983040, 1, 0, -983039, 1, 0, -917503, 1, 0, -851970, 1, 0, -786435, 1, 0, -851972, 1, 0, -983043, 1, 0, -720900, 1, 0, -655365, 1, 0, -851973, 1, 0, -786437, 1, 0, -589831, 1, 0, -458758, 1, 0, -393223, 1, 0, -458759, 1, 0, -524293, 1, 0, -458757, 1, 0, -393222, 1, 0, -589828, 1, 0, -655364, 1, 0, -720899, 1, 0, -327688, 1, 0, -262153, 1, 0, -327689, 1, 0, -393225, 1, 0, -196617, 1, 0, -131082, 1, 0, -65546, 1, 0, -393224, 1, 0, -458760, 1, 0, -524296, 1, 0, 1376249, 131073, 0, 1441783, 196609, 0, -720894, 131073, 0, -851969, 1, 0, -1048578, 1, 0, -983042, 1, 0, -917507, 1, 0, -1048579, 1, 0, -917506, 1, 0, -983041, 1, 0, -1048577, 1, 0, -1048576, 1, 0, -917501, 1, 0, -851965, 1, 0, -786428, 1, 0, -720892, 1, 0, -786429, 1, 0, -983037, 1, 0, -917500, 1, 0, -851964, 1, 0, -786427, 1, 0, -720891, 1, 0, -524282, 1, 0, -327673, 1, 0, -196599, 1, 0, -131062, 1, 0, -327671, 1, 0, -393207, 1, 0, -458744, 1, 0, -524280, 1, 0, -589817, 1, 0, -589818, 1, 0, -655354, 1, 0, -1048572, 1, 0, -983036, 1, 0, -917499, 1, 0, -851963, 1, 0, -393208, 1, 0, -655353, 1, 0, -720890, 1, 0, -786426, 1, 0, -1114108, 1, 0, -1048571, 1, 0, -983035, 1, 0, -917498, 1, 0, -851962, 1, 0, -786425, 1, 0, -720889, 1, 0, -655352, 1, 0, -589816, 1, 0, -524279, 1, 0, -458743, 1, 0, -393206, 1, 0, -327670, 1, 0, -262134, 1, 0, -196598, 1, 0, -131061, 1, 0, -65526, 1, 0, -262133, 1, 0, -196597, 1, 0, -65525, 1, 0, 11, 1, 0, 65547, 1, 0, 131083, 1, 0, 12, 1, 0, 131084, 1, 0, 196619, 1, 0, -131060, 1, 0, -65524, 1, 0, 65548, 1, 0, 131085, 1, 0, 196620, 1, 0, 262157, 1, 0, 327692, 1, 0, 262156, 1, 0, 1245187, 1, 0, 1310723, 1, 0, 1376258, 1, 0, 1572863, 1, 0, 1507327, 1, 0, 1441791, 1, 0, 1245181, 1, 0, 1310717, 1, 0, 1376254, 1, 0, 1441789, 1, 0, 1507326, 1, 0, 1572862, 1, 0, 1376247, 196609, 0, 1310711, 196609, 0, 1114102, 131073, 0, 1179637, 131073, 0, 1245174, 131073, 0, 1310709, 131073, 0, 1310710, 131073, 0, 1507322, 131073, 0, 1572857, 131073, 0, 1638393, 131073, 0, 1572860, 1, 0, 1507325, 1, 0, 1376253, 1, 0, 1310716, 1, 0, 1441788, 1, 0, 1507324, 1, 0, 1572859, 1, 0, 1507323, 1, 0, 1441787, 1, 0, 1376252, 1, 0, 1441790, 1, 0, 1572861, 1, 0, 1638397, 1, 0, 1638396, 1, 0, 1703931, 1, 0, 1638395, 1, 0, 1703930, 1, 0, 1638394, 1, 0, 1572858, 1, 0, 1703932, 1, 0, 1703933, 1, 0, 1638398, 1, 0, 1638399, 1, 0, 1572864, 1, 0, 1572865, 1, 0, 1507329, 1, 0, 1572866, 1, 0, 1507330, 1, 0, 1638401, 1, 0, 1638400, 1, 0, 1703935, 1, 0, 1769471, 1, 0, 1703934, 1, 0, 1769470, 1, 0, 1441794, 1, 0, 1376259, 1, 0, 1310724, 1, 0, 1245188, 1, 0, 1310725, 1, 0, 1245189, 1, 0, 1179654, 1, 0, 1114118, 1, 0, 1048583, 1, 0, 1114119, 1, 0, 1048584, 1, 0, 1179655, 1, 0, 1441795, 1, 0, 1507331, 1, 0, 1441796, 1, 0, 1376260, 1, 0, 1376261, 1, 0, 1310726, 1, 0, 1245190, 1, 0, 1245191, 1, 0, 1179656, 1, 0) [node name="Solid Tilemap" type="TileMap" parent="."] y_sort_enabled = true @@ -6062,7 +6063,7 @@ format = 2 layer_0/name = "Layer 1" layer_0/y_sort_enabled = true layer_0/y_sort_origin = 16 -layer_0/tile_data = PackedInt32Array(-327682, 262144, 1, -262147, 262144, 1, -196610, 262144, 1, -131075, 262144, 1, -65539, 262144, 1, -4, 262144, 1, 65532, 262144, 1, -393218, 262144, 1, -458753, 262144, 1, -393217, 262144, 1, -524288, 262144, 1, -458752, 262144, 1, -524287, 262144, 1, -458751, 262144, 1, -524286, 262144, 1, -458750, 262144, 1, -393213, 262144, 1, -327677, 262144, 1, -262140, 262144, 1, -196604, 262144, 1, -131068, 262144, 1, -65532, 262144, 1, 5, 262144, 1, 65540, 262144, 1, 131077, 262144, 1, 196612, 262144, 1, 262148, 262144, 1, 327683, 262144, 1, 393219, 262144, 1, 458754, 262144, 1, 524290, 262144, 1, 589825, 262144, 1, 655361, 262144, 1, 720896, 262144, 1, 655360, 262144, 1, 131068, 262144, 1, 196605, 262144, 1, 655356, 393216, 2, 720892, 393216, 2, 786428, 393216, 2, 720893, 393216, 2, 786427, 393216, 2, 851964, 393216, 2, 720891, 393216, 2, 655355, 393216, 2, 589820, 393216, 2, 393215, 393216, 2) +layer_0/tile_data = PackedInt32Array(-196610, 262144, 1, -131075, 262144, 1, -65539, 262144, 1, -4, 262144, 1, 65532, 262144, 1, -393217, 262144, 1, -524288, 262144, 1, -524286, 262144, 1, -458750, 262144, 1, -393213, 262144, 1, -327677, 262144, 1, -262140, 262144, 1, -196604, 262144, 1, 131068, 262144, 1, 196605, 262144, 1, 262141, 262144, 1, 458751, 262144, 1, 524287, 262144, 1, 524288, 262144, 1, 589824, 262144, 1, -65531, 262144, 1, -131067, 262144, 1, -589823, 262144, 1, -655359, 262144, 1, -589824, 262144, 1, -327681, 262144, 1, -262146, 262144, 1, 524289, 262144, 1, 458753, 262144, 1, 393218, 262144, 1, 327682, 262144, 1, 262147, 262144, 1, 196611, 262144, 1, 131076, 262144, 1, 65540, 262144, 1, 5, 262144, 1, -524287, 786432, 3, -458751, 786432, 3, -3, 983040, 18, -65538, 589824, 19, -131074, 0, 21) [node name="ReferenceRect" type="ReferenceRect" parent="."] visible = false @@ -6087,4 +6088,5 @@ position = Vector2(12, 0) [node name="CharacterBody2D" parent="." instance=ExtResource("3_8k37m")] position = Vector2(78, -15) -[node name="Camera2D" type="Camera2D" parent="."] +[node name="CameraController" type="Camera2D" parent="."] +script = ExtResource("6_t8ide") diff --git a/addons/smoothing/LICENSE b/addons/smoothing/LICENSE new file mode 100644 index 00000000..17424756 --- /dev/null +++ b/addons/smoothing/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Lawnjelly + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/addons/smoothing/plugin.cfg b/addons/smoothing/plugin.cfg new file mode 100644 index 00000000..f263daeb --- /dev/null +++ b/addons/smoothing/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="Smoothing" +description="Smoothing nodes for fixed timestep interpolation." +author="Lawnjelly" +version="1.2.1" +script="smoothing_plugin.gd" diff --git a/addons/smoothing/smoothing.gd b/addons/smoothing/smoothing.gd new file mode 100644 index 00000000..7cda59e6 --- /dev/null +++ b/addons/smoothing/smoothing.gd @@ -0,0 +1,235 @@ +# Copyright (c) 2019 Lawnjelly +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +extends Node3D + +@export +var target: NodePath: + get: + return target + set(v): + target = v + set_target() + + +var _m_Target: Node3D + +var _m_trCurr: Transform3D +var _m_trPrev: Transform3D + +const SF_ENABLED = 1 << 0 +const SF_TRANSLATE = 1 << 1 +const SF_BASIS = 1 << 2 +const SF_SLERP = 1 << 3 +const SF_INVISIBLE = 1 << 4 + +@export_flags("enabled", "translate", "basis", "slerp") var flags: int = SF_ENABLED | SF_TRANSLATE | SF_BASIS: + set(v): + flags = v + # we may have enabled or disabled + _SetProcessing() + get: + return flags + + +########################################################################################## +# USER FUNCS + + +# call this checked e.g. starting a level, AFTER moving the target +# so we can update both the previous and current values +func teleport(): + var temp_flags = flags + _SetFlags(SF_TRANSLATE | SF_BASIS) + + _RefreshTransform() + _m_trPrev = _m_trCurr + + # do one frame update to make sure all components are updated + _process(0) + + # resume old flags + flags = temp_flags + + +func set_enabled(bEnable: bool): + _ChangeFlags(SF_ENABLED, bEnable) + _SetProcessing() + + +func is_enabled(): + return _TestFlags(SF_ENABLED) + + +########################################################################################## + + +func _ready(): + _m_trCurr = Transform3D() + _m_trPrev = Transform3D() + set_process_priority(100) + set_as_top_level(true) + Engine.set_physics_jitter_fix(0.0) + + +func set_target(): + if is_inside_tree(): + _FindTarget() + + +func _set_flags(new_value): + flags = new_value + # we may have enabled or disabled + _SetProcessing() + + +func _get_flags(): + return flags + + +func _SetProcessing(): + var bEnable = _TestFlags(SF_ENABLED) + if _TestFlags(SF_INVISIBLE): + bEnable = false + + set_process(bEnable) + set_physics_process(bEnable) + pass + + +func _enter_tree(): + # might have been moved + _FindTarget() + pass + + +func _notification(what): + match what: + # invisible turns unchecked processing + NOTIFICATION_VISIBILITY_CHANGED: + _ChangeFlags(SF_INVISIBLE, is_visible_in_tree() == false) + _SetProcessing() + + +func _RefreshTransform(): + if _HasTarget() == false: + return + + _m_trPrev = _m_trCurr + _m_trCurr = _m_Target.global_transform + +func _FindTarget(): + _m_Target = null + + # If no target has been assigned in the property, + # default to using the parent as the target. + if target.is_empty(): + var parent = get_parent_node_3d() + if parent: + _m_Target = parent + return + + var targ = get_node(target) + + if ! targ: + printerr("ERROR SmoothingNode : Target " + str(target) + " not found") + return + + if not targ is Node3D: + printerr("ERROR SmoothingNode : Target " + str(target) + " is not node 3D") + target = "" + return + + # if we got to here targ is a spatial + _m_Target = targ + + # certain targets are disallowed + if _m_Target == self: + var msg = str(_m_Target.get_name()) + " assigned to " + str(self.get_name()) + "]" + printerr("ERROR SmoothingNode : Target should not be self [", msg) + + # error message + #OS.alert("Target cannot be a parent or grandparent in the scene tree.", "SmoothingNode") + _m_Target = null + target = "" + return + + +func _HasTarget() -> bool: + if _m_Target == null: + return false + + # has not been deleted? + if is_instance_valid(_m_Target): + return true + + _m_Target = null + return false + + +func _process(_delta): + + var f = Engine.get_physics_interpolation_fraction() + var tr: Transform3D = Transform3D() + + # translate + if _TestFlags(SF_TRANSLATE): + var ptDiff = _m_trCurr.origin - _m_trPrev.origin + tr.origin = _m_trPrev.origin + (ptDiff * f) + + # rotate + if _TestFlags(SF_BASIS): + if _TestFlags(SF_SLERP): + tr.basis = _m_trPrev.basis.slerp(_m_trCurr.basis, f) + else: + tr.basis = _LerpBasis(_m_trPrev.basis, _m_trCurr.basis, f) + + transform = tr + + +func _physics_process(_delta): + _RefreshTransform() + + +func _LerpBasis(from: Basis, to: Basis, f: float) -> Basis: + var res: Basis = Basis() + res.x = from.x.lerp(to.x, f) + res.y = from.y.lerp(to.y, f) + res.z = from.z.lerp(to.z, f) + return res + + +func _SetFlags(f): + flags |= f + + +func _ClearFlags(f): + flags &= ~f + + +func _TestFlags(f): + return (flags & f) == f + + +func _ChangeFlags(f, bSet): + if bSet: + _SetFlags(f) + else: + _ClearFlags(f) diff --git a/addons/smoothing/smoothing.png b/addons/smoothing/smoothing.png new file mode 100644 index 00000000..ab6fc1e5 --- /dev/null +++ b/addons/smoothing/smoothing.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c59503b7f1448f645d70673bc614bbe90300c55a4714394e45759c1e146bf047 +size 343 diff --git a/addons/smoothing/smoothing.png.import b/addons/smoothing/smoothing.png.import new file mode 100644 index 00000000..298007d5 --- /dev/null +++ b/addons/smoothing/smoothing.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bm44ebnxqc82" +path="res://.godot/imported/smoothing.png-6b454a779e636eaa20b6c6ac618bf82a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/smoothing/smoothing.png" +dest_files=["res://.godot/imported/smoothing.png-6b454a779e636eaa20b6c6ac618bf82a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/addons/smoothing/smoothing_2d.gd b/addons/smoothing/smoothing_2d.gd new file mode 100644 index 00000000..783a5f1c --- /dev/null +++ b/addons/smoothing/smoothing_2d.gd @@ -0,0 +1,218 @@ +# Copyright (c) 2019 Lawnjelly +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +extends Node2D + + +@export +var target: NodePath: + get: + return target + set(v): + target = v + if is_inside_tree(): + _FindTarget() + +var _m_Target: Node2D +var _m_Flip:bool = false + +var _m_Trans_curr: Transform2D = Transform2D() +var _m_Trans_prev: Transform2D = Transform2D() + +const SF_ENABLED = 1 << 0 +const SF_GLOBAL_IN = 1 << 1 +const SF_GLOBAL_OUT = 1 << 2 +const SF_TOP_LEVEL = 1 << 3 +const SF_INVISIBLE = 1 << 4 +# ADDED: Pixel snap support. +const SF_PIXELSNAP = 1 << 5 + +@export_flags("enabled", "global in", "global out", "top level", "pixel snap") var flags: int = SF_ENABLED | SF_GLOBAL_IN | SF_GLOBAL_OUT | SF_PIXELSNAP: + set(v): + flags = v + # we may have enabled or disabled + _SetProcessing() + get: + return flags + +########################################################################################## +# USER FUNCS + + +# call this checked e.g. starting a level, AFTER moving the target +# so we can update both the previous and current values +func teleport(): + _RefreshTransform() + _m_Trans_prev = _m_Trans_curr + + # call frame upate to make sure all components of the node are set + _process(0) + + +func set_enabled(bEnable: bool): + _ChangeFlags(SF_ENABLED, bEnable) + _SetProcessing() + + +func is_enabled(): + return _TestFlags(SF_ENABLED) + +func set_pixel_snap(bPixelSnap: bool): + _ChangeFlags(SF_PIXELSNAP, bPixelSnap) + +########################################################################################## + + +func _ready(): + set_process_priority(100) + Engine.set_physics_jitter_fix(0.0) + set_as_top_level(_TestFlags(SF_TOP_LEVEL)) + + +func _SetProcessing(): + var bEnable = _TestFlags(SF_ENABLED) + if _TestFlags(SF_INVISIBLE): + bEnable = false + + set_process(bEnable) + set_physics_process(bEnable) + set_as_top_level(_TestFlags(SF_TOP_LEVEL)) + + +func _enter_tree(): + # might have been moved + _FindTarget() + + +func _notification(what): + match what: + # invisible turns unchecked processing + NOTIFICATION_VISIBILITY_CHANGED: + _ChangeFlags(SF_INVISIBLE, is_visible_in_tree() == false) + _SetProcessing() + + +func _RefreshTransform(): + + if _HasTarget() == false: + return + + _m_Trans_prev = _m_Trans_curr + + if _TestFlags(SF_GLOBAL_IN): + _m_Trans_curr = _m_Target.get_global_transform() + else: + _m_Trans_curr = _m_Target.get_transform() + + _m_Flip = false + # Ideally we would use determinant core function, as in commented line below, but we + # need to workaround for backward compat. + # if (_m_Trans_prev.determinant() < 0) != (_m_Trans_curr.determinant() < 0): + + if (_Determinant_Sign(_m_Trans_prev) != _Determinant_Sign(_m_Trans_curr)): + _m_Flip = true + +func _Determinant_Sign(t:Transform2D)->bool: + # Workaround Transform2D determinant function not being available + # until 3.6 / 4.1. + # We calculate determinant manually, slower but compatible to lower + # godot versions. + var d = (t.x.x * t.y.y) - (t.x.y * t.y.x) + return d >= 0.0 + + +func _FindTarget(): + _m_Target = null + + # If no target has been assigned in the property, + # default to using the parent as the target. + if target.is_empty(): + var parent = get_parent() + if parent and (parent is Node2D): + _m_Target = parent + return + + var targ = get_node(target) + + if ! targ: + printerr("ERROR SmoothingNode2D : Target " + str(target) + " not found") + return + + if not targ is Node2D: + printerr("ERROR SmoothingNode2D : Target " + str(target) + " is not Node2D") + target = "" + return + + # if we got to here targ is correct type + _m_Target = targ + +func _HasTarget() -> bool: + if _m_Target == null: + return false + + # has not been deleted? + if is_instance_valid(_m_Target): + return true + + _m_Target = null + return false + + +func _process(_delta): + var f = Engine.get_physics_interpolation_fraction() + + var tr = Transform2D() + tr.origin = lerp(_m_Trans_prev.origin, _m_Trans_curr.origin, f) + if _TestFlags(SF_PIXELSNAP): + tr.origin = (tr.origin + Vector2(0.5, 0.5)).floor() + tr.x = lerp(_m_Trans_prev.x, _m_Trans_curr.x, f) + tr.y = lerp(_m_Trans_prev.y, _m_Trans_curr.y, f) + + # When a sprite flip is detected, turn off interpolation for that tick. + if _m_Flip: + tr = _m_Trans_curr + + if _TestFlags(SF_GLOBAL_OUT) and not _TestFlags(SF_TOP_LEVEL): + set_global_transform(tr) + else: + set_transform(tr) + + +func _physics_process(_delta): + _RefreshTransform() + + +func _SetFlags(f): + flags |= f + + +func _ClearFlags(f): + flags &= ~f + + +func _TestFlags(f): + return (flags & f) == f + + +func _ChangeFlags(f, bSet): + if bSet: + _SetFlags(f) + else: + _ClearFlags(f) diff --git a/addons/smoothing/smoothing_2d.png b/addons/smoothing/smoothing_2d.png new file mode 100644 index 00000000..23c287ad --- /dev/null +++ b/addons/smoothing/smoothing_2d.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1df945f58c90e44c80e3cb3f6f09da561194658902631bac91386d737c0b6b39 +size 343 diff --git a/addons/smoothing/smoothing_2d.png.import b/addons/smoothing/smoothing_2d.png.import new file mode 100644 index 00000000..5f2ea116 --- /dev/null +++ b/addons/smoothing/smoothing_2d.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://i3h8ng5fyd1m" +path="res://.godot/imported/smoothing_2d.png-4942c58db397caab18506104d957cac1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/smoothing/smoothing_2d.png" +dest_files=["res://.godot/imported/smoothing_2d.png-4942c58db397caab18506104d957cac1.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/addons/smoothing/smoothing_plugin.gd b/addons/smoothing/smoothing_plugin.gd new file mode 100644 index 00000000..3bf6fb12 --- /dev/null +++ b/addons/smoothing/smoothing_plugin.gd @@ -0,0 +1,17 @@ +@tool +extends EditorPlugin + + +func _enter_tree(): + # Initialization of the plugin goes here + # Add the new type with a name, a parent type, a script and an icon + add_custom_type("Smoothing", "Node3D", preload("smoothing.gd"), preload("smoothing.png")) + add_custom_type("Smoothing2D", "Node2D", preload("smoothing_2d.gd"), preload("smoothing_2d.png")) + pass + + +func _exit_tree(): + # Clean-up of the plugin goes here + # Always remember to remove_at it from the engine when deactivated + remove_custom_type("Smoothing") + remove_custom_type("Smoothing2D") diff --git a/project.godot b/project.godot index b274165c..1246fba4 100644 --- a/project.godot +++ b/project.godot @@ -17,16 +17,17 @@ config/icon="res://icon.svg" [display] -window/size/viewport_width=640 -window/size/viewport_height=480 -window/stretch/mode="viewport" -window/stretch/scale=4.0 -window/stretch/scale_mode="integer" +window/size/viewport_width=1920 +window/size/viewport_height=1080 [dotnet] project/assembly_name="Cirno" +[editor_plugins] + +enabled=PackedStringArray("res://addons/smoothing/plugin.cfg") + [input] left={ @@ -70,10 +71,12 @@ shoot={ 2d_physics/layer_2="player" 2d_physics/layer_3="items" +[physics] + +common/physics_jitter_fix=0.0 + [rendering] textures/canvas_textures/default_texture_filter=0 renderer/rendering_method="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility" -2d/snap/snap_2d_transforms_to_pixel=true -2d/snap/snap_2d_vertices_to_pixel=true