Compare commits

..

2 Commits
4.1 ... 4.0

Author SHA1 Message Date
Aaron Franke
58bfd8d0b0 [4.0] Simplify list of branches in the README (#1255) 2025-10-02 17:05:45 -07:00
Arman Papikyan
05c8f82297 Add editor-only roughness and metallic testers to Material Testers (#899)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-03-29 18:34:24 +02:00
878 changed files with 7272 additions and 11116 deletions

View File

@@ -1,7 +1,23 @@
<!--
Please target the `master` branch in priority.
PRs can target `3.x` if the same change was done in `master`, or is not relevant there.
Only submit a pull request if all of the following conditions are met:
Relevant fixes are cherry-picked for stable branches as needed by maintainers.
You can mention in the description if the change is compatible with `3.x`.
* It must work with the latest Godot version of the branch you're submitting to.
* It must follow all of the Godot style guides, including the GDScript
style guide and the C# style guide.
* The demo should not be overcomplicated. Simplicity is usually preferred.
* If you are submitting a new demo, please ensure that it includes a
README file similar to the other demos.
* If you are submitting a copy of a demo translated to C# etc:
* Please ensure that there is a good reason to have this demo translated.
We don't want to have multiple copies of every single project.
* Please ensure that the code mirrors the original closely.
* In the project.godot file and in the README, include "with C#" etc in
the title, and also include a link to the original in the README.
-->

1
.gitignore vendored
View File

@@ -20,4 +20,3 @@ mono_crash.*.json
.directory
.DS_Store
*~
*.blend1

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/bullet.png-ff1424653e10246c11e3724e402c519e.c
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/face_happy.png-38d387d31ec13459f749c93ce3d75d
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/face_sad.png-0ac7165eab24f595aba17a746a66c550
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

BIN
2d/bullet_shower/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c8w03v671qh3y"
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/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

View File

@@ -8,14 +8,16 @@
config_version=5
_global_script_classes=[]
_global_script_class_icons={}
[application]
config/name="Bullet Shower"
config/description="Demonstrates how to manage large amounts of objects efficiently using low-level Servers."
run/main_scene="res://shower.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official", "performance")
config/icon="res://icon.png"
[display]

View File

@@ -7,13 +7,7 @@
[sub_resource type="SpriteFrames" id="1"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("3")
}, {
"duration": 1.0,
"texture": ExtResource("4")
}],
"frames": [ExtResource("3"), ExtResource("4")],
"loop": true,
"name": &"default",
"speed": 5.0
@@ -31,7 +25,7 @@ script = ExtResource("2")
script = ExtResource("5")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Player"]
sprite_frames = SubResource("1")
frames = SubResource("1")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
shape = SubResource("2")

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -2,7 +2,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bpov140lx7at3"
uid="uid://brsl7ypls5f57"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -19,8 +19,7 @@ tutorial in the documentation. For more details, consider
following the tutorial in the documentation."
run/main_scene="res://Main.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official")
config/icon="res://icon.png"
[debug]

View File

@@ -1,13 +0,0 @@
# 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: GDScript
Renderer: OpenGL
## Screenshots
![Screenshot](screenshots/fake_wall.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,57 +0,0 @@
extends TileMap
var secret_layer: int # You can have multiple layers if you make this an array.
var player_in_secret: bool
var layer_alpha := 1.0
func _init() -> void:
for i in get_layers_count(): # Find the secret layer by name.
if get_layer_name(i) == "Secret":
secret_layer = i
func _ready() -> void:
set_process(false)
func _process(delta: float) -> void:
if player_in_secret:
if layer_alpha > 0.3:
layer_alpha = move_toward(layer_alpha, 0.3, delta) # Animate the layer transparency.
set_layer_modulate(secret_layer, Color(1, 1, 1, layer_alpha))
else:
set_process(false)
else:
if layer_alpha < 1.0:
layer_alpha = move_toward(layer_alpha, 1.0, delta)
set_layer_modulate(secret_layer, Color(1, 1, 1, layer_alpha))
else:
set_process(false)
func _use_tile_data_runtime_update(layer: int, _coords: Vector2i) -> bool:
if layer == secret_layer:
return true
return false
func _tile_data_runtime_update(_layer: int, _coords: Vector2i, tile_data: TileData) -> void:
tile_data.set_collision_polygons_count(0, 0) # Remove collision for secret layer.
func _on_secret_detector_body_entered(body: Node2D) -> void:
if not body is CharacterBody2D: # Detect player only.
return
player_in_secret = true
set_process(true)
func _on_secret_detector_body_exited(body: Node2D) -> void:
if not body is CharacterBody2D:
return
player_in_secret = false
set_process(true)

View File

@@ -1,32 +0,0 @@
extends CharacterBody2D
const WALK_FORCE = 600
const WALK_MAX_SPEED = 200
const STOP_FORCE = 1300
const JUMP_SPEED = 200
@onready var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
func _physics_process(delta):
# Horizontal movement code. First, get the player's input.
var walk = WALK_FORCE * (Input.get_axis(&"move_left", &"move_right"))
# Slow down the player if they're not trying to move.
if abs(walk) < WALK_FORCE * 0.2:
# The velocity, slowed down a bit, and then reassigned.
velocity.x = move_toward(velocity.x, 0, STOP_FORCE * delta)
else:
velocity.x += walk * delta
# Clamp to the maximum horizontal movement speed.
velocity.x = clamp(velocity.x, -WALK_MAX_SPEED, WALK_MAX_SPEED)
# Vertical movement code. Apply gravity.
velocity.y += gravity * delta
# 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.
move_and_slide()
# Check for jumping. is_on_floor() must be called after movement code.
if is_on_floor() and Input.is_action_just_pressed(&"jump"):
velocity.y = -JUMP_SPEED

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

View File

@@ -1,34 +0,0 @@
[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

View File

@@ -1,17 +0,0 @@
[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 )

View File

@@ -1,66 +0,0 @@
; 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"
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")
config/icon="res://icon.png"
[display]
window/size/viewport_width=530
window/size/viewport_height=495
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,57 +0,0 @@
[gd_scene load_steps=8 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/tile_map.gd" id="2_q8fhk"]
[ext_resource type="PackedScene" path="res://player/player.tscn" id="3"]
[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)
1:0/0 = 0
1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:0/0/physics_layer_0/angular_velocity = 0.0
[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/enabled = true
layer_1/modulate = Color(1, 1, 1, 1)
layer_1/y_sort_enabled = false
layer_1/y_sort_origin = 0
layer_1/z_index = 0
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_q8fhk")
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(265, 247)
[node name="Player" parent="." instance=ExtResource("3")]
position = Vector2(120, 456)
[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="_on_secret_detector_body_entered"]
[connection signal="body_exited" from="SecretDetector" to="TileMap" method="_on_secret_detector_body_exited"]

View File

@@ -60,8 +60,8 @@ text = "This example shows how to apply the State programming pattern in GDScrip
States are common in games. You can use the pattern to:
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage.
2. Respect the Single Responsibility Principle. Each State object represents one action.
1. Separate each behavior and transitions between behaviors, thus make scripts shorter and easier to manage
2. Respect the Single Responsibility Principle. Each State object represents one action
3. Improve your code's structure. Look at the scene tree and FileSystem tab: without looking at the code, you'll know what the Player can or cannot do.
You can read more about States in the excellent Game Programming Patterns ebook."

View File

@@ -17,7 +17,7 @@ grow_vertical = 2
[node name="Title" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = "StateStack"
text = "Pushown"
uppercase = true
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://nev7b6ohgeo"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
uid="uid://cmdjuhfejngkf"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"]
source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -16,8 +16,7 @@ pattern in GDscript, including Hierarchical States, and a
pushdown automaton."
run/main_scene="res://Demo.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "ai", "demo", "official")
config/icon="res://icon.png"
[display]
@@ -87,7 +86,7 @@ simulate_damage={
attack={
"deadzone": 0.5,
"events": [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":70,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
]
}

BIN
2d/glow/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

34
2d/glow/icon.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bsjtxyyenw6db"
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/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -16,9 +16,8 @@ config/description="This showcases how to use glow in a 2D game via the WorldEnv
Slide the cave image left and right to observe the glow effect at work."
run/main_scene="res://beach_cave.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/icon="res://icon.png"
run/name=""
config/tags=PackedStringArray("2d", "demo", "official", "rendering")
[display]

BIN
2d/hexagonal_map/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ddqj5gbtw2cxw"
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/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -14,8 +14,7 @@ config/name="Hexagonal Game"
config/description="Very simple demo showing a hexagonal TileMap and TileSet."
run/main_scene="res://map.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official", "tilemap")
config/icon="res://icon.png"
[display]

BIN
2d/instancing/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brbriwsl8w3bw"
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/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -15,8 +15,7 @@ config/description="A demo showing how to use scene instancing to
make many duplicates of the same object."
run/main_scene="res://scene_instancing.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official")
config/icon="res://icon.png"
[display]

BIN
2d/isometric/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://ny54l3w66vw3"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
uid="uid://cyuecw0rd5i3y"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"]
source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -17,8 +17,7 @@ A character can move around the level and will also slide around objects,
as well as be occluded when standing in front or behind them."
run/main_scene="res://dungeon.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official", "tilemap")
config/icon="res://icon.png"
[display]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -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/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/circle.png-65a28e998f412b3cddff971e28b7d768.c
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/long_obstacle.png-d70ee394f796e1de9a423783aa8
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/obstacle.png-06287f6b2d26dd03335fd87ab78c2cc2
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/princess.png-359cb1d8a4fd115119b22ac7899e2787
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/player.png-1ad27fc2a62fa126eae918723933dd6f.c
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,8 +16,7 @@ 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.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official", "physics")
config/icon="res://icon.png"
[display]
@@ -33,25 +32,25 @@ jump={
"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)
, 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,"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,"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,"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)
, 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,"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,"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)
, 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,"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,"unicode":0,"echo":false,"script":null)
]
}

View File

@@ -134,7 +134,6 @@ position = Vector2(268.651, 152)
shape = SubResource("3")
[node name="Sprite2D" type="Sprite2D" parent="MovingPlatform1"]
modulate = Color(0.4, 2, 0.8, 1)
texture = ExtResource("2")
[node name="AnimationPlayer" type="AnimationPlayer" parent="MovingPlatform1"]
@@ -151,7 +150,6 @@ position = Vector2(88.3493, 152)
shape = SubResource("3")
[node name="Sprite2D" type="Sprite2D" parent="MovingPlatform2"]
modulate = Color(0.4, 2, 0.8, 1)
texture = ExtResource("2")
[node name="AnimationPlayer" type="AnimationPlayer" parent="MovingPlatform2"]
@@ -231,7 +229,6 @@ position = Vector2(241.169, 304.126)
rotation = -0.0790058
[node name="Sprite2D" type="Sprite2D" parent="Circle"]
modulate = Color(0.4, 2, 0.8, 1)
texture = ExtResource("5")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Circle"]
@@ -244,7 +241,6 @@ libraries = {
}
[node name="BoxSprite" type="Sprite2D" parent="Circle"]
modulate = Color(0.4, 2, 0.8, 1)
position = Vector2(-3.05176e-05, -37.4108)
texture = ExtResource("2")
@@ -276,6 +272,7 @@ shape = SubResource("12")
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(265, 247)
current = true
[node name="Player" parent="." instance=ExtResource("3")]
position = Vector2(233.06, 223.436)

BIN
2d/light2d_as_mask/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://1obhenjndqh"
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/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -14,8 +14,7 @@ config/name="2D Lights as Mask"
config/description="Example of how to use 2D lights to mask objects on screen."
run/main_scene="res://lightmask.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official", "rendering")
config/icon="res://icon.png"
[display]

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/background.png-98289422cd7d93003950872a7b9702
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/caster.png-67727cb056b9e0209664a84f1653a25a.c
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/godot.png-5e0da45ed3d6786d5794553e04f58a8c.ct
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/godot_normal.png-7f91d6bfda6a23aaa1320ed999c2
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://byckt0v7uvncx"
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/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/light.png-06e94102f0cce323cff7daad56cf3030.ct
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -15,8 +15,7 @@ config/description="Simple demo of 2D lights and shadows,
using PointLight2D and LightOccluder2D."
run/main_scene="res://light_shadows.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.webp"
config/tags=PackedStringArray("2d", "demo", "official", "rendering")
config/icon="res://icon.png"
[display]
@@ -28,21 +27,21 @@ window/stretch/aspect="expand"
toggle_directional_light={
"deadzone": 0.5,
"events": [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":68,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [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":68,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
]
}
toggle_point_lights={
"deadzone": 0.5,
"events": [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":80,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [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":80,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
]
}
cycle_directional_light_shadows_quality={
"deadzone": 0.5,
"events": [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":83,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [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":83,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
]
}
cycle_point_light_shadows_quality={
"deadzone": 0.5,
"events": [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":72,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [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":72,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
]
}

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/spot.png-36b4dfbff4efeea17ec3137d266ffc4a.cte
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -1,13 +1,14 @@
# Navigation Polygon 2D
Example of using 2D navigation using:
- [`NavigationRegion2D`](https://docs.godotengine.org/en/latest/classes/class_navigationregion2d.html)
- [`NavigationPolygon`](https://docs.godotengine.org/en/latest/classes/class_navigationpolygon.html)
- [`NavigationAgent2D`](https://docs.godotengine.org/en/latest/classes/class_navigationagent2d.html)
Example of using 2D navigation using a
[`NavigationPolygon`](https://docs.godotengine.org/en/latest/classes/class_navigationpolygon.html)
in a [`NavigationPolygonInstance`](https://docs.godotengine.org/en/latest/classes/class_navigationpolygoninstance.html) node.
It uses the 2D navigation API to request a path between two points,
and then traverses the resulting path.
Language: GDScript
Renderer: Forward+
Renderer: GLES 2
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/117

View File

@@ -1,36 +0,0 @@
extends CharacterBody2D
var movement_speed: float = 200.0
@onready var navigation_agent: NavigationAgent2D = $NavigationAgent2D
func _ready():
# These values need to be adjusted for the actor's speed
# and the navigation layout.
navigation_agent.path_desired_distance = 2.0
navigation_agent.target_desired_distance = 2.0
navigation_agent.debug_enabled = true
# The "click" event is a custom input action defined in
# Project > Project Settings > Input Map tab.
func _unhandled_input(event):
if not event.is_action_pressed("click"):
return
set_movement_target(get_global_mouse_position())
func set_movement_target(movement_target: Vector2):
navigation_agent.target_position = movement_target
func _physics_process(_delta):
if navigation_agent.is_navigation_finished():
return
var current_agent_position: Vector2 = global_position
var next_path_position: Vector2 = navigation_agent.get_next_path_position()
velocity = current_agent_position.direction_to(next_path_position) * movement_speed
move_and_slide()

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/character.png-7a996d3b758d22c506b76a7c1539128
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -1,22 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://ct7veakwiei3h"]
[ext_resource type="Script" path="res://character.gd" id="1_8uimh"]
[ext_resource type="Texture2D" uid="uid://b0wokaenwu7pj" path="res://character.png" id="1_rmg12"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_20ukx"]
radius = 7.0
height = 22.0
[node name="Character" type="CharacterBody2D"]
script = ExtResource("1_8uimh")
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(0, -3)
scale = Vector2(0.3, 0.3)
texture = ExtResource("1_rmg12")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -3)
shape = SubResource("CapsuleShape2D_20ukx")
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]

BIN
2d/navigation/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://2ft5n3ts7upn"
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/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

32
2d/navigation/level.tscn Normal file
View File

@@ -0,0 +1,32 @@
[gd_scene load_steps=5 format=3 uid="uid://cur17tkfqetf0"]
[ext_resource type="Script" path="res://navigation.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://bk26gi6qsuh18" path="res://map.png" id="2"]
[ext_resource type="Texture2D" uid="uid://b0wokaenwu7pj" path="res://character.png" id="3"]
[sub_resource type="NavigationPolygon" id="NavigationPolygon_5ynhe"]
vertices = PackedVector2Array(682, 496, 696, 300, 704, 507, 495, 256, 589, 270, 540, 284, 466, 177, 490, 169, 531, 178, 477, 205, 446, 196, 621, 510, 667, 525, 606, 519, 529, 290, 288, 228, 228, 180, 276, 160, 315, 190, 600, 497, 576, 503, 202, 99, 314, 65, 311, 83, 436, 170, 452, 163, 201, 440, 246, 478, 223, 490, 211, 485, 146, 400, 185, 381, 586, 178, 596, 188, 474, 252, 462, 127, 479, 150, 416, 180, 395, 516, 302, 499, 320, 450, 354, 445, 535, 516, 538, 106, 537, 173, 493, 166, 506, 97, 514, 51, 486, 83, 327, 77, 309, 96, 306, 113, 272, 153, 219, 172, 178, 152, 148, 224, 189, 231, 171, 328, 176, 347, 259, 404, 432, 249, 365, 346, 525, 342, 314, 340, 271, 336, 241, 321, 235, 284, 242, 247, 324, 336, 616, 360, 645, 381, 645, 404, 614, 492)
polygons = [PackedInt32Array(0, 1, 2), PackedInt32Array(3, 4, 5), PackedInt32Array(6, 7, 8, 9, 10), PackedInt32Array(11, 0, 2, 12, 13), PackedInt32Array(3, 5, 14), PackedInt32Array(15, 16, 17, 18), PackedInt32Array(19, 11, 13, 20), PackedInt32Array(21, 22, 23), PackedInt32Array(6, 10, 24, 25), PackedInt32Array(26, 27, 28, 29, 30), PackedInt32Array(31, 26, 30), PackedInt32Array(32, 33, 3, 34), PackedInt32Array(18, 35, 36, 25, 24), PackedInt32Array(18, 24, 37), PackedInt32Array(38, 39, 40, 41, 42), PackedInt32Array(43, 44, 45, 46), PackedInt32Array(47, 43, 46, 48), PackedInt32Array(49, 47, 48, 50, 23), PackedInt32Array(21, 23, 50, 51, 52, 53, 54), PackedInt32Array(55, 54, 53, 56), PackedInt32Array(30, 55, 56, 57), PackedInt32Array(30, 57, 58), PackedInt32Array(31, 30, 58), PackedInt32Array(31, 58, 59, 40), PackedInt32Array(40, 59, 41), PackedInt32Array(18, 37, 60, 15), PackedInt32Array(20, 42, 41, 61, 60, 34, 3, 62), PackedInt32Array(63, 64, 65, 66, 67, 15, 60, 68), PackedInt32Array(61, 68, 60), PackedInt32Array(62, 69, 70, 71, 72, 19, 20), PackedInt32Array(62, 3, 14)]
outlines = [PackedVector2Array(314, 65, 311, 83, 327, 77, 514, 51, 538, 106, 537, 173, 493, 166, 506, 97, 486, 83, 309, 96, 306, 113, 272, 153, 219, 172, 189, 231, 171, 328, 176, 347, 259, 404, 354, 445, 365, 346, 324, 336, 314, 340, 271, 336, 241, 321, 235, 284, 242, 247, 288, 228, 228, 180, 276, 160, 315, 190, 462, 127, 479, 150, 452, 163, 466, 177, 490, 169, 531, 178, 477, 205, 446, 196, 436, 170, 416, 180, 432, 249, 474, 252, 586, 178, 596, 188, 495, 256, 589, 270, 540, 284, 529, 290, 525, 342, 616, 360, 645, 381, 645, 404, 614, 492, 600, 497, 621, 510, 682, 496, 696, 300, 704, 507, 667, 525, 606, 519, 576, 503, 535, 516, 395, 516, 302, 499, 320, 450, 185, 381, 201, 440, 246, 478, 223, 490, 211, 485, 146, 400, 148, 224, 178, 152, 202, 99)]
[node name="Node2D" type="Node2D"]
script = ExtResource("1")
[node name="Map" type="Sprite2D" parent="."]
position = Vector2(429.585, 287.32)
texture = ExtResource("2")
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(420, 300)
current = true
[node name="Character" type="Sprite2D" parent="."]
position = Vector2(228.464, 132.594)
scale = Vector2(0.5, 0.5)
texture = ExtResource("3")
offset = Vector2(0, -26)
[node name="NavigationRegion2d" type="NavigationRegion2D" parent="."]
navpoly = SubResource("NavigationPolygon_5ynhe")
[node name="NavigationAgent2d" type="NavigationAgent2D" parent="."]

View File

@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/map.png-9eea34967fae34f4388f4a32a16da936.ctex
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View File

@@ -0,0 +1,60 @@
extends Node2D
@export var character_speed: float = 400.0
var path = []
@onready var character = $Character
#var navmap = NavigationServer2D.map_create()
func _ready():
pass
#NavigationServer2D.region_set_map(navmap, $NavigationRegion2d.get_rid())
func _process(delta):
character.position = $NavigationAgent2d.get_next_location()
var walk_distance = character_speed * delta
#move_along_path(walk_distance)
# The "click" event is a custom input action defined in
# Project > Project Settings > Input Map tab.
func _unhandled_input(event):
if not event.is_action_pressed("click"):
return
_update_navigation_path(Vector2(), get_local_mouse_position())
#func move_along_path(distance):
# return
# var last_point = character.position
# while path.size():
# var distance_between_points = last_point.distance_to(path[0])
# # The position to move to falls between two points.
# if distance <= distance_between_points:
# character.position = last_point.lerp(path[0], distance / distance_between_points)
# return
# # The position is past the end of the segment.
# distance -= distance_between_points
# last_point = path[0]
# path.remove(0)
# # The character reached the end of the path.
# character.position = last_point
# set_process(false)
var drawpos = Vector2()
func _update_navigation_path(start_position, end_position):
# get_simple_path is part of the Node2D class.
# It returns a PackedVector2Array of points that lead you
# from the start_position to the end_position.
$NavigationAgent2d.set_target_location(end_position)
drawpos = end_position
queue_redraw()
# The first point is always the start_position.
# We don't need it in this example as it corresponds to the character's position.
#path.remove(0)
#set_process(true)
func _draw():
draw_circle(drawpos, 10, Color.RED)

View File

@@ -1,18 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://bjgad00c2xiuc"]
[ext_resource type="Texture2D" uid="uid://bk26gi6qsuh18" path="res://map.png" id="2_nxfkp"]
[ext_resource type="NavigationPolygon" uid="uid://bk5r48dcijlqt" path="res://navigation_polygon.res" id="3_6c0vu"]
[ext_resource type="PackedScene" uid="uid://ct7veakwiei3h" path="res://character.tscn" id="4_n6iop"]
[node name="Navigation" type="Node2D"]
[node name="Map" type="Sprite2D" parent="."]
z_index = -1
position = Vector2(400, 302)
texture = ExtResource("2_nxfkp")
[node name="NavigationRegion2D" type="NavigationRegion2D" parent="."]
navigation_polygon = ExtResource("3_6c0vu")
[node name="Character" parent="." instance=ExtResource("4_n6iop")]
position = Vector2(211, 141)

Binary file not shown.

View File

@@ -14,10 +14,9 @@ config/name="Navigation Polygon 2D"
config/description="Example of using 2D navigation using a NavigationPolygon in a
NavigationPolygonInstance node. It uses the 2D navigation API to request
a path between two points, and then traverses the resulting path."
config/tags=PackedStringArray("2d", "ai", "demo", "official")
run/main_scene="res://navigation.tscn"
config/features=PackedStringArray("4.1")
config/icon="res://icon.webp"
run/main_scene="res://level.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.png"
[display]
@@ -29,7 +28,7 @@ window/stretch/aspect="expand"
click={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://5rxk8qdqtutc"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
uid="uid://mra54hir677u"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"]
source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brwp8bimc75uu"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.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

View File

@@ -8,13 +8,18 @@ const DRAW_COLOR = Color.WHITE
# The object for pathfinding on 2D grids.
var _astar = AStarGrid2D.new()
var _map_rect = Rect2i()
var _start_point = Vector2i()
var _end_point = Vector2i()
var _path = PackedVector2Array()
func _ready():
_astar.region = get_used_rect()
# Let's assume that the entire map is located at non-negative coordinates.
var map_size = get_used_rect().end
_map_rect = Rect2i(Vector2i(), map_size)
_astar.size = map_size
_astar.cell_size = CELL_SIZE
_astar.offset = CELL_SIZE * 0.5
_astar.default_compute_heuristic = AStarGrid2D.HEURISTIC_MANHATTAN
@@ -22,8 +27,8 @@ func _ready():
_astar.diagonal_mode = AStarGrid2D.DIAGONAL_MODE_NEVER
_astar.update()
for i in range(_astar.region.position.x, _astar.region.end.x):
for j in range(_astar.region.position.y, _astar.region.end.y):
for i in map_size.x:
for j in map_size.y:
var pos = Vector2i(i, j)
if get_cell_source_id(0, pos) == Tile.OBSTACLE:
_astar.set_point_solid(pos)
@@ -47,7 +52,7 @@ func round_local_position(local_position):
func is_point_walkable(local_position):
var map_position = local_to_map(local_position)
if _astar.is_in_boundsv(map_position):
if _map_rect.has_point(map_position):
return not _astar.is_point_solid(map_position)
return false

Some files were not shown because too many files have changed in this diff Show More