From 1760bd50f08c2f4299654d88584e7b008800cb1d Mon Sep 17 00:00:00 2001 From: DevDaddyFromDownUnder Date: Sat, 16 Dec 2023 12:35:09 +1000 Subject: [PATCH] Port Dynamic Tilemap Layers 2D demo to C# Godot mono 4.2 --- .../Dynamic TileMap Layers.csproj | 9 ++ .../Dynamic TileMap Layers.sln | 19 ++++ mono/dynamic_tilemap_layers/README.md | 13 +++ mono/dynamic_tilemap_layers/icon.png | Bin 0 -> 4387 bytes mono/dynamic_tilemap_layers/icon.png.import | 34 +++++++ mono/dynamic_tilemap_layers/level/TileMap.cs | 94 ++++++++++++++++++ .../dynamic_tilemap_layers/level/obstacle.png | Bin 0 -> 1857 bytes .../level/obstacle.png.import | 34 +++++++ mono/dynamic_tilemap_layers/player/Player.cs | 52 ++++++++++ mono/dynamic_tilemap_layers/player/player.png | Bin 0 -> 502 bytes .../player/player.png.import | 34 +++++++ .../dynamic_tilemap_layers/player/player.tscn | 17 ++++ mono/dynamic_tilemap_layers/project.godot | 71 +++++++++++++ .../screenshots/.gdignore | 0 .../screenshots/fake_wall.png | Bin 0 -> 11250 bytes mono/dynamic_tilemap_layers/world.tscn | 51 ++++++++++ 16 files changed, 428 insertions(+) create mode 100644 mono/dynamic_tilemap_layers/Dynamic TileMap Layers.csproj create mode 100644 mono/dynamic_tilemap_layers/Dynamic TileMap Layers.sln create mode 100644 mono/dynamic_tilemap_layers/README.md create mode 100644 mono/dynamic_tilemap_layers/icon.png create mode 100644 mono/dynamic_tilemap_layers/icon.png.import create mode 100644 mono/dynamic_tilemap_layers/level/TileMap.cs create mode 100644 mono/dynamic_tilemap_layers/level/obstacle.png create mode 100644 mono/dynamic_tilemap_layers/level/obstacle.png.import create mode 100644 mono/dynamic_tilemap_layers/player/Player.cs create mode 100644 mono/dynamic_tilemap_layers/player/player.png create mode 100644 mono/dynamic_tilemap_layers/player/player.png.import create mode 100644 mono/dynamic_tilemap_layers/player/player.tscn create mode 100644 mono/dynamic_tilemap_layers/project.godot create mode 100644 mono/dynamic_tilemap_layers/screenshots/.gdignore create mode 100644 mono/dynamic_tilemap_layers/screenshots/fake_wall.png create mode 100644 mono/dynamic_tilemap_layers/world.tscn diff --git a/mono/dynamic_tilemap_layers/Dynamic TileMap Layers.csproj b/mono/dynamic_tilemap_layers/Dynamic TileMap Layers.csproj new file mode 100644 index 0000000000..193609ae2c --- /dev/null +++ b/mono/dynamic_tilemap_layers/Dynamic TileMap Layers.csproj @@ -0,0 +1,9 @@ + + + net6.0 + net7.0 + net8.0 + true + DynamicTileMapLayers + + \ No newline at end of file diff --git a/mono/dynamic_tilemap_layers/Dynamic TileMap Layers.sln b/mono/dynamic_tilemap_layers/Dynamic TileMap Layers.sln new file mode 100644 index 0000000000..0ebc0036bd --- /dev/null +++ b/mono/dynamic_tilemap_layers/Dynamic TileMap Layers.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dynamic TileMap Layers", "Dynamic TileMap Layers.csproj", "{CBDF7372-1B42-4099-8207-2705FC7B78A6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CBDF7372-1B42-4099-8207-2705FC7B78A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CBDF7372-1B42-4099-8207-2705FC7B78A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CBDF7372-1B42-4099-8207-2705FC7B78A6}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {CBDF7372-1B42-4099-8207-2705FC7B78A6}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {CBDF7372-1B42-4099-8207-2705FC7B78A6}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {CBDF7372-1B42-4099-8207-2705FC7B78A6}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU + EndGlobalSection +EndGlobal diff --git a/mono/dynamic_tilemap_layers/README.md b/mono/dynamic_tilemap_layers/README.md new file mode 100644 index 0000000000..172d2e4568 --- /dev/null +++ b/mono/dynamic_tilemap_layers/README.md @@ -0,0 +1,13 @@ +# Dynamic TileMap Layers + +Example of how to make a fake wall using TileMap's +`_tile_data_runtime_update()` method. It shows how +to disable collisions per layer. + +Language: C# + +Renderer: OpenGL + +## Screenshots + +![Screenshot](screenshots/fake_wall.png) diff --git a/mono/dynamic_tilemap_layers/icon.png b/mono/dynamic_tilemap_layers/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1f364d686bc11a6e6dbf4dfbdd7ee8dee6c36972 GIT binary patch literal 4387 zcmZ`*RZtWRv|d6|T)Jav=~zHOaA}s5mhSHEE?J~gLOP{$VF~FDX=y2GlyX7p@;}^{ zJ98ht@63GX%!xTOXAVqFRUQwA5(fYP;3+_5G@h-*f51Y0W@g-9FaQ9z(qBv0Q^U*$ zYdT-c)?Gkxw2ZP3YZ#l<}?0+~r=Q$H0RO>eYrX zKiU_Q^$VdwF{n6E39C=Y&7H@76Lygf&Qg2L>-)V7gOk9@$ED3+!yM#rx6Q^DAE~kR z3*@hl`|zIQ;`0$fHx=a1@rM+rG-IysnGQF$Vj~^rSME7CLq-4AUSIeN(q4?Cgk)X# z<~JQ}O-xzu=aD=e?5Ir_8*Y9Uc2!1Xu+{Y$+!)t>*wGF`&bh(&%IP|-ZRw+T-;bC@ z(W?Gf@`{GRM9y^EhJ-B;L-yKuIrN6aVAM#0l?7)hkca!Y0fl>eBb<*uEOaS}$@UNP5Fu)C_0PEmF_z37 zKsbnyOlK%J1ywcP+hsA$buymtx0wbOh{=v!Von3IDwnxxocV)!g;EM91H0^3fx~Qp zstSAc@j>H}2?kjuwwC5uhp+953;OmoHQr0+O1obLoJtoK^?$E5H+k52)qM#gkf-z; z`K~TU<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iS047djDu2F}00mi9nOZ5+@c#i;w1wLM literal 0 HcmV?d00001 diff --git a/mono/dynamic_tilemap_layers/icon.png.import b/mono/dynamic_tilemap_layers/icon.png.import new file mode 100644 index 0000000000..110035528e --- /dev/null +++ b/mono/dynamic_tilemap_layers/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bpov140lx7at3" +path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.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/mono/dynamic_tilemap_layers/level/TileMap.cs b/mono/dynamic_tilemap_layers/level/TileMap.cs new file mode 100644 index 0000000000..465d1f67a7 --- /dev/null +++ b/mono/dynamic_tilemap_layers/level/TileMap.cs @@ -0,0 +1,94 @@ +using Godot; + +public partial class TileMap : Godot.TileMap +{ + // You can have multiple layers if you make _secretLayer an array. + private int _secretLayer; + private bool _playerInSecret; + private double _layerAlpha = 1.0; + + public TileMap() + { + // Find the secret layer by name. + for (int i = 0; i < GetLayersCount(); i++) + { + if (GetLayerName(i) == "Secret") + { + _secretLayer = i; + } + } + } + + public override void _Ready() + { + SetProcess(false); + } + + public override void _Process(double delta) + { + if (_playerInSecret) + { + if (_layerAlpha > 0.3) + { + // Animate the layer transparency. + _layerAlpha = Mathf.MoveToward(_layerAlpha, 0.3, delta); + SetLayerModulate(_secretLayer, new Color(1, 1, 1, (float)_layerAlpha)); + } + else + { + SetProcess(false); + } + } + else + { + if (_layerAlpha < 1.0) + { + _layerAlpha = Mathf.MoveToward(_layerAlpha, 1.0, delta); + SetLayerModulate(_secretLayer, new Color(1, 1, 1, (float)_layerAlpha)); + } + else + { + SetProcess(false); + } + } + } + + public override bool _UseTileDataRuntimeUpdate(int layer, Vector2I coords) + { + if (layer == _secretLayer) + { + return true; + } + + return false; + } + + public override void _TileDataRuntimeUpdate(int layer, Vector2I coords, TileData tileData) + { + // Remove collision for secret layer. + tileData.SetCollisionPolygonsCount(0, 0); + } + + private void OnSecretDetectorBodyEntered(Node2D body) + { + // Detect player only. + if (body is not CharacterBody2D) + { + return; + } + + _playerInSecret = true; + SetProcess(true); + } + + public void OnSecretDetectorBodyExited(Node2D body) + { + if (body is not CharacterBody2D) + { + return; + } + + _playerInSecret = false; + SetProcess(true); + } +} diff --git a/mono/dynamic_tilemap_layers/level/obstacle.png b/mono/dynamic_tilemap_layers/level/obstacle.png new file mode 100644 index 0000000000000000000000000000000000000000..781df346405c0907c87aa41e198581099a1f6a39 GIT binary patch literal 1857 zcmV-H2fp};P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1Y;vh*el{Ld+J1SBDr<6yv5xj~MfX7#+8`I5>q zuJ=q~A&G9O!L&bqzs+y>QSxk@hUk;`7C)C<;*3GG&#$d_vi9y{hd)|#bgany_^?NW z=i5BvEqKeEJn^JEl9vVkyy@FK>D#=VF#IEw`B6L-L6TI7!cw@2V3toVG~%Wau24kaO0Z;tGs24Tm_7Kf&sRtH zT{=XB-EXXr7jvh9I*QW&!wQ7Zz3WH^!25asfmk?ku<9^JY%tqvy10~{+7dH}78okt zZY~aWIRHe6tw@Fh3|LR1a zEd(M|yaZ5_B!esG)Oq8Ai>RTjqE1!42926Dd-2Yz_dfXEi#bSeL4yw=#E?Rc5?$2j zV~8=Pm`&m&=v7TVg%ndtIU{I>=Zw`kW=vds$>lD+{1vWvr7IVdPjN+yFQLSeN;Z|N zR9Ch78fvVm=0**r)Lhf%TWGPRmT#2W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?d00001 diff --git a/mono/dynamic_tilemap_layers/level/obstacle.png.import b/mono/dynamic_tilemap_layers/level/obstacle.png.import new file mode 100644 index 0000000000..59598a7a6a --- /dev/null +++ b/mono/dynamic_tilemap_layers/level/obstacle.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cs8h2qyuakmko" +path="res://.godot/imported/obstacle.png-06287f6b2d26dd03335fd87ab78c2cc2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://level/obstacle.png" +dest_files=["res://.godot/imported/obstacle.png-06287f6b2d26dd03335fd87ab78c2cc2.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/mono/dynamic_tilemap_layers/player/Player.cs b/mono/dynamic_tilemap_layers/player/Player.cs new file mode 100644 index 0000000000..dd046eeff7 --- /dev/null +++ b/mono/dynamic_tilemap_layers/player/Player.cs @@ -0,0 +1,52 @@ +using Godot; + +public partial class Player : CharacterBody2D +{ + private const float WalkForce = 600; + private const float WalkMaxSpeed = 200; + private const float StopForce = 1300; + private const float JumpSpeed = 200; + private int _gravity; + + public override void _Ready() + { + _gravity = (int)ProjectSettings.GetSetting("physics/2d/default_gravity"); + } + + public override void _PhysicsProcess(double delta) + { + Vector2 velocity = Velocity; + + // Horizontal movement code. First, get the player's input. + float walk = WalkForce * Input.GetAxis("move_left", "move_right"); + + // Slow down the player if they're not trying to move. + if (Mathf.Abs(walk) < WalkForce * 0.2) + { + // The velocity, slowed down a bit, and then reassigned. + velocity.X = (float)Mathf.MoveToward(velocity.X, 0, StopForce * delta); + } + else + { + velocity.X += (float)(walk * delta); + } + + // Clamp to the maximum horizontal movement speed. + velocity.X = Mathf.Clamp(velocity.X, -WalkMaxSpeed, WalkMaxSpeed); + + // Vertical movement code. Apply gravity. + velocity.Y += (float)(_gravity * delta); + + // Check for jumping. is_on_floor() must be called after movement code. + if (IsOnFloor() && Input.IsActionJustPressed("jump")) + { + velocity.Y = -JumpSpeed; + } + + // Move based on the velocity and snap to the ground. + // TODO: This information should be set to the CharacterBody properties instead of arguments: snap, Vector2.DOWN, Vector2.UP + // TODO: Rename velocity to linear_velocity in the rest of the script. + Velocity = velocity; + MoveAndSlide(); + } +} diff --git a/mono/dynamic_tilemap_layers/player/player.png b/mono/dynamic_tilemap_layers/player/player.png new file mode 100644 index 0000000000000000000000000000000000000000..0e7d843899f3f6c0ebca826205fbfb9539f1ca64 GIT binary patch literal 502 zcmV-F-CkOoOeVkE3#)pu`j%%rMz1M8|0lgS|w<{5B%%hpwNHGMRdNoH=i z3BzQPN~X7*dMFI?>Y%#lT=$3~;@v}TFLd`K<;e7{clSYeQ%BR)L?%1}u9h=`Yc5)i zNU&Fn$_PU+wg sv+MI1=?2|Nn^k*9dByv8V%IYN0DUsQX@FNMwEzGB07*qoM6N<$g1T(inE(I) literal 0 HcmV?d00001 diff --git a/mono/dynamic_tilemap_layers/player/player.png.import b/mono/dynamic_tilemap_layers/player/player.png.import new file mode 100644 index 0000000000..ec8c1fa51f --- /dev/null +++ b/mono/dynamic_tilemap_layers/player/player.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dfb8rr2fakwgp" +path="res://.godot/imported/player.png-1ad27fc2a62fa126eae918723933dd6f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://player/player.png" +dest_files=["res://.godot/imported/player.png-1ad27fc2a62fa126eae918723933dd6f.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/mono/dynamic_tilemap_layers/player/player.tscn b/mono/dynamic_tilemap_layers/player/player.tscn new file mode 100644 index 0000000000..25320c7c10 --- /dev/null +++ b/mono/dynamic_tilemap_layers/player/player.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://player/player.gd" type="Script" id=1] +[ext_resource path="res://player/player.png" type="Texture2D" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2(7, 7) + +[node name="Player" type="CharacterBody2D"] +script = ExtResource( 1 ) + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(-0.315559, 0.157784) +shape = SubResource( 1 ) diff --git a/mono/dynamic_tilemap_layers/project.godot b/mono/dynamic_tilemap_layers/project.godot new file mode 100644 index 0000000000..317df4f625 --- /dev/null +++ b/mono/dynamic_tilemap_layers/project.godot @@ -0,0 +1,71 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Dynamic TileMap Layers with C#" +config/description="Example of how to make a kinematic character controller in 2D using +CharacterBody2D. The character moves around, is affected by moving +platforms, can jump through one-way collision platforms, etc." +run/main_scene="res://world.tscn" +config/features=PackedStringArray("4.2", "C#") +config/icon="res://icon.png" +config/tags=PackedStringArray("2d", "demo") + +[display] + +window/size/viewport_width=530 +window/size/viewport_height=495 +window/stretch/mode="canvas_items" +window/stretch/aspect="expand" + +[dotnet] + +project/assembly_name="Dynamic TileMap Layers" + +[input] + +jump={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} +move_left={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} +move_right={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} + +[physics] + +common/physics_ticks_per_second=120 +2d/default_gravity=500 + +[rendering] + +renderer/rendering_method="gl_compatibility" +environment/defaults/default_clear_color=Color(0.156863, 0.133333, 0.25098, 1) +anti_aliasing/quality/msaa_2d=2 diff --git a/mono/dynamic_tilemap_layers/screenshots/.gdignore b/mono/dynamic_tilemap_layers/screenshots/.gdignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/mono/dynamic_tilemap_layers/screenshots/fake_wall.png b/mono/dynamic_tilemap_layers/screenshots/fake_wall.png new file mode 100644 index 0000000000000000000000000000000000000000..38ce07c930bc6a7b3b73f2020bc49cb39941b73e GIT binary patch literal 11250 zcmeHrhg(zK(r-|TAP6EVy^4TRqzKY`5tQCL2-15eLTD-R1}O9004mMp@xb+0C0g8 z03h19bOAq;&{$9d0NkVuH8l0tw+mwT_Vs$|;_k@qAL8xE?ilRy6aWaGgk&uybJqvP zoV8PA0R;LZ-{g~tfo%%QJ7ceV^(>FWXKs=Ns61t*>pumb$^B~HPq%t~`@Ozj-^8|1 z-T1S`bl2w7HQZ-2;4W}p9v8kS2loB-@sQW~it@+pn6fQj|X>i+D zuYvS*|KNZv!7-`FK*Y~6dM3dsH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T!g2a0%O}ISeEE)_C7s1LNJ7&Fi$ty*@H`j7A=x7ix zR8L_n@l13)hcHD*5l^TFw4yY=3?+r!kwHQpm#Dc36!xco;7*G*FG^eEk^O_!uh=X4 zvuv@e!AHH)5c6hkgj`q|w10QzPt`;B*Al08HHcb*!-k#N)_p*j!7+ zO&~PU+|8rUcMT3YV$sE@4Z$MufeQGtE*t6vf#`fpTbL|LrR^K$bXD1?hP*;_3?Ch8 z&8-4U2vLWStuJ7)6gne&G>~$ExwXU3}ux;ZaAA)+QMn8ItCy7bpps8 zQxN^8Z+$Hab(b<7q0)hsf~3<6PBr)W!UeSw2hX=pwYc^7lcv+3PBz8s7H6A9)aTs; zos6^jk;J~syMJ^M*tpJ)lUAy6p9!6zJ_7a5FcA*6I&XN;A9#4k9EShVlXx<};Wk(B zHzNq7fgL=WAoLm*5|c5guA&VmLMtI%UJc*r30^w+ectEj?!kbxj{hNcl(rxJH)ps7 zQzGJTWB3M)%-;Xo+L=-q)1Ug9buljpJ&I%D?WxKAp+uX~b&Ed?JDq;Ex&9~Lf9{pE zhwT!y9pVq7|JY0UvloIJA_Qj@|91Ve*K%qX#smT!L#IM~rZ`#geM!JWRc)0@CEKX~ E1INgB1poj5 literal 0 HcmV?d00001 diff --git a/mono/dynamic_tilemap_layers/world.tscn b/mono/dynamic_tilemap_layers/world.tscn new file mode 100644 index 0000000000..4c13ef16a2 --- /dev/null +++ b/mono/dynamic_tilemap_layers/world.tscn @@ -0,0 +1,51 @@ +[gd_scene load_steps=9 format=3 uid="uid://de7qapkqfycxl"] + +[ext_resource type="Texture2D" uid="uid://cs8h2qyuakmko" path="res://level/obstacle.png" id="2"] +[ext_resource type="Script" path="res://level/TileMap.cs" id="2_jlggc"] +[ext_resource type="PackedScene" path="res://player/player.tscn" id="3"] +[ext_resource type="Script" path="res://player/Player.cs" id="4_af5cp"] + +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_on5ov"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_vnjib"] +texture = ExtResource("2") +0:0/0 = 0 +0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:0/0/physics_layer_0/angular_velocity = 0.0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) + +[sub_resource type="TileSet" id="TileSet_xqlka"] +physics_layer_0/collision_layer = 1 +physics_layer_0/physics_material = SubResource("PhysicsMaterial_on5ov") +sources/0 = SubResource("TileSetAtlasSource_vnjib") + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_a2gec"] +size = Vector2(112, 48) + +[node name="World" type="Node2D"] + +[node name="TileMap" type="TileMap" parent="."] +z_index = 1 +tile_set = SubResource("TileSet_xqlka") +format = 2 +layer_0/name = "Ground" +layer_0/tile_data = PackedInt32Array(0, 0, 0, 65536, 0, 0, 131072, 0, 0, 196608, 0, 0, 262144, 0, 0, 327680, 0, 0, 393216, 0, 0, 458752, 0, 0, 524288, 0, 0, 589824, 0, 0, 655360, 0, 0, 720896, 0, 0, 786432, 0, 0, 851968, 0, 0, 917504, 0, 0, 983040, 0, 0, 1048576, 0, 0, 1114112, 0, 0, 1179648, 0, 0, 1245184, 0, 0, 1310720, 0, 0, 1376256, 0, 0, 1441792, 0, 0, 1507328, 0, 0, 1572864, 0, 0, 1638400, 0, 0, 1703936, 0, 0, 1769472, 0, 0, 1835008, 0, 0, 1900544, 0, 0, 1966080, 0, 0, 1, 0, 0, 65537, 0, 0, 131073, 0, 0, 196609, 0, 0, 262145, 0, 0, 327681, 0, 0, 393217, 0, 0, 458753, 0, 0, 524289, 0, 0, 589825, 0, 0, 655361, 0, 0, 720897, 0, 0, 786433, 0, 0, 851969, 0, 0, 917505, 0, 0, 983041, 0, 0, 1048577, 0, 0, 1114113, 0, 0, 1179649, 0, 0, 1245185, 0, 0, 1310721, 0, 0, 1376257, 0, 0, 1441793, 0, 0, 1507329, 0, 0, 1572865, 0, 0, 1638401, 0, 0, 1703937, 0, 0, 1769473, 0, 0, 1835009, 0, 0, 1900545, 0, 0, 1966081, 0, 0, 2, 0, 0, 65538, 0, 0, 1900546, 0, 0, 1966082, 0, 0, 3, 0, 0, 65539, 0, 0, 1900547, 0, 0, 1966083, 0, 0, 4, 0, 0, 65540, 0, 0, 1900548, 0, 0, 1966084, 0, 0, 5, 0, 0, 65541, 0, 0, 1900549, 0, 0, 1966085, 0, 0, 6, 0, 0, 65542, 0, 0, 1900550, 0, 0, 1966086, 0, 0, 7, 0, 0, 65543, 0, 0, 1900551, 0, 0, 1966087, 0, 0, 8, 0, 0, 65544, 0, 0, 1900552, 0, 0, 1966088, 0, 0, 9, 0, 0, 65545, 0, 0, 1900553, 0, 0, 1966089, 0, 0, 10, 0, 0, 65546, 0, 0, 1900554, 0, 0, 1966090, 0, 0, 11, 0, 0, 65547, 0, 0, 1900555, 0, 0, 1966091, 0, 0, 12, 0, 0, 65548, 0, 0, 1900556, 0, 0, 1966092, 0, 0, 13, 0, 0, 65549, 0, 0, 1900557, 0, 0, 1966093, 0, 0, 14, 0, 0, 65550, 0, 0, 1900558, 0, 0, 1966094, 0, 0, 15, 0, 0, 65551, 0, 0, 1900559, 0, 0, 1966095, 0, 0, 16, 0, 0, 65552, 0, 0, 1900560, 0, 0, 1966096, 0, 0, 17, 0, 0, 65553, 0, 0, 1900561, 0, 0, 1966097, 0, 0, 18, 0, 0, 65554, 0, 0, 1900562, 0, 0, 1966098, 0, 0, 19, 0, 0, 65555, 0, 0, 1900563, 0, 0, 1966099, 0, 0, 20, 0, 0, 65556, 0, 0, 1900564, 0, 0, 1966100, 0, 0, 21, 0, 0, 65557, 0, 0, 1900565, 0, 0, 1966101, 0, 0, 22, 0, 0, 65558, 0, 0, 1900566, 0, 0, 1966102, 0, 0, 23, 0, 0, 65559, 0, 0, 1900567, 0, 0, 1966103, 0, 0, 24, 0, 0, 65560, 0, 0, 1900568, 0, 0, 1966104, 0, 0, 25, 0, 0, 65561, 0, 0, 1900569, 0, 0, 1966105, 0, 0, 26, 0, 0, 65562, 0, 0, 1900570, 0, 0, 1966106, 0, 0, 27, 0, 0, 65563, 0, 0, 1900571, 0, 0, 1966107, 0, 0, 28, 0, 0, 65564, 0, 0, 1900572, 0, 0, 1966108, 0, 0, 29, 0, 0, 65565, 0, 0, 1900573, 0, 0, 1966109, 0, 0, 30, 0, 0, 65566, 0, 0, 1900574, 0, 0, 1966110, 0, 0, 31, 0, 0, 65567, 0, 0, 131103, 0, 0, 196639, 0, 0, 262175, 0, 0, 327711, 0, 0, 393247, 0, 0, 458783, 0, 0, 524319, 0, 0, 589855, 0, 0, 655391, 0, 0, 720927, 0, 0, 786463, 0, 0, 851999, 0, 0, 917535, 0, 0, 983071, 0, 0, 1048607, 0, 0, 1114143, 0, 0, 1179679, 0, 0, 1245215, 0, 0, 1310751, 0, 0, 1376287, 0, 0, 1441823, 0, 0, 1507359, 0, 0, 1572895, 0, 0, 1638431, 0, 0, 1703967, 0, 0, 1769503, 0, 0, 1835039, 0, 0, 1900575, 0, 0, 1966111, 0, 0, 32, 0, 0, 65568, 0, 0, 131104, 0, 0, 196640, 0, 0, 262176, 0, 0, 327712, 0, 0, 393248, 0, 0, 458784, 0, 0, 524320, 0, 0, 589856, 0, 0, 655392, 0, 0, 720928, 0, 0, 786464, 0, 0, 852000, 0, 0, 917536, 0, 0, 983072, 0, 0, 1048608, 0, 0, 1114144, 0, 0, 1179680, 0, 0, 1245216, 0, 0, 1310752, 0, 0, 1376288, 0, 0, 1441824, 0, 0, 1507360, 0, 0, 1572896, 0, 0, 1638432, 0, 0, 1703968, 0, 0, 1769504, 0, 0, 1835040, 0, 0, 1900576, 0, 0, 1966112, 0, 0, 1572878, 0, 0, 1572879, 0, 0, 1572880, 0, 0, 1572881, 0, 0, 1572882, 0, 0, 1572883, 0, 0, 1572884, 0, 0, 1507348, 0, 0, 1441812, 0, 0, 1441811, 0, 0, 1441810, 0, 0, 1441809, 0, 0, 1441808, 0, 0, 1441807, 0, 0, 1441806, 0, 0, 1507342, 0, 0, 1507343, 0, 0, 1507344, 0, 0, 1507345, 0, 0, 1507346, 0, 0, 1507347, 0, 0, 1638414, 0, 0, 1638415, 0, 0, 1638416, 0, 0, 1638417, 0, 0, 1638418, 0, 0, 1638419, 0, 0, 1638420, 0, 0) +layer_1/name = "Secret" +layer_1/tile_data = PackedInt32Array(1703950, 0, 0, 1769486, 0, 0, 1835022, 0, 0, 1703951, 0, 0, 1769487, 0, 0, 1835023, 0, 0, 1703952, 0, 0, 1769488, 0, 0, 1835024, 0, 0, 1703953, 0, 0, 1769489, 0, 0, 1835025, 0, 0, 1703954, 0, 0, 1769490, 0, 0, 1835026, 0, 0, 1703955, 0, 0, 1769491, 0, 0, 1835027, 0, 0, 1703956, 0, 0, 1769492, 0, 0, 1835028, 0, 0) +script = ExtResource("2_jlggc") + +[node name="Camera2D" type="Camera2D" parent="."] +offset = Vector2(265, 247) + +[node name="Player" parent="." instance=ExtResource("3")] +position = Vector2(120, 456) +script = ExtResource("4_af5cp") + +[node name="SecretDetector" type="Area2D" parent="."] +position = Vector2(280, 440) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="SecretDetector"] +shape = SubResource("RectangleShape2D_a2gec") + +[connection signal="body_entered" from="SecretDetector" to="TileMap" method="OnSecretDetectorBodyEntered"] +[connection signal="body_exited" from="SecretDetector" to="TileMap" method="OnSecretDetectorBodyExited"]