diff --git a/src/area_2d_starter/Ball.gd b/src/area_2d_starter/Ball.gd index 49c140c..2fe7ec5 100644 --- a/src/area_2d_starter/Ball.gd +++ b/src/area_2d_starter/Ball.gd @@ -2,4 +2,4 @@ extends RigidBody2D func _on_VisibilityNotifier2D_screen_exited(): - queue_free() \ No newline at end of file + queue_free() diff --git a/src/area_2d_starter/Ball.tscn b/src/area_2d_starter/Ball.tscn index 6f74582..8c3ca31 100644 --- a/src/area_2d_starter/Ball.tscn +++ b/src/area_2d_starter/Ball.tscn @@ -1,26 +1,27 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=5 format=3 uid="uid://cem8bb7lkb7sr"] -[ext_resource path="res://Ball.gd" type="Script" id=1] -[ext_resource path="res://assets/ballBlue_09.png" type="Texture" id=2] +[ext_resource type="Script" path="res://Ball.gd" id="1"] +[ext_resource type="Texture2D" uid="uid://b2bimjy3075py" path="res://assets/ballBlue_09.png" id="2"] -[sub_resource type="PhysicsMaterial" id=2] +[sub_resource type="PhysicsMaterial" id="2"] friction = 0.1 bounce = 0.25 -[sub_resource type="CircleShape2D" id=1] +[sub_resource type="CircleShape2D" id="1"] radius = 14.8321 [node name="Ball" type="RigidBody2D"] -physics_material_override = SubResource( 2 ) +physics_material_override = SubResource("2") gravity_scale = 5.0 -script = ExtResource( 1 ) +script = ExtResource("1") -[node name="Sprite" type="Sprite" parent="."] -scale = Vector2( 0.2, 0.2 ) -texture = ExtResource( 2 ) +[node name="Sprite2D" type="Sprite2D" parent="."] +scale = Vector2(0.2, 0.2) +texture = ExtResource("2") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -shape = SubResource( 1 ) +shape = SubResource("1") -[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] -[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"] +[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."] + +[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"] diff --git a/src/area_2d_starter/World.gd b/src/area_2d_starter/World.gd index 51c4e34..045d127 100644 --- a/src/area_2d_starter/World.gd +++ b/src/area_2d_starter/World.gd @@ -6,16 +6,16 @@ var Ball = load("res://Ball.tscn") func _draw(): # Draw shaded regions to show the areas. draw_circle($Point.position, $Point/CollisionShape2D.shape.radius, - Color(1, 1, 1, 0.1)) - var s = $Antigrav/CollisionShape2D.shape.extents - draw_rect(Rect2($Antigrav.position-s, s * 2), Color(1, 1, 0, 0.1)) - s = $Slow/CollisionShape2D.shape.extents - draw_rect(Rect2($Slow.position-s, s * 2), Color(0, 1, 1, 0.1)) + Color(1, 1, 1, 0.1)) + var s = $Antigrav/CollisionShape2D.shape.size + draw_rect(Rect2($Antigrav.position - (s / 2), s), Color(1, 1, 0, 0.1)) + s = $Slow/CollisionShape2D.shape.size + draw_rect(Rect2($Slow.position - (s / 2), s), Color(0, 1, 1, 0.1)) func _unhandled_input(event): if event is InputEventMouseButton and event.pressed: - if event.button_index == BUTTON_LEFT: - var b = Ball.instance() + if event.button_index == MOUSE_BUTTON_LEFT: + var b = Ball.instantiate() b.position = event.position - add_child(b) \ No newline at end of file + add_child(b) diff --git a/src/area_2d_starter/World.tscn b/src/area_2d_starter/World.tscn index 82ad1a7..661abda 100644 --- a/src/area_2d_starter/World.tscn +++ b/src/area_2d_starter/World.tscn @@ -1,104 +1,108 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=8 format=3 uid="uid://cwghg4um8ohpo"] -[ext_resource path="res://World.gd" type="Script" id=1] -[ext_resource path="res://assets/Roboto-Bold.ttf" type="DynamicFontData" id=2] +[ext_resource type="Script" path="res://World.gd" id="1"] +[ext_resource type="FontFile" uid="uid://sjnahvlt0cil" path="res://assets/Roboto-Bold.ttf" id="2"] -[sub_resource type="RectangleShape2D" id=2] -extents = Vector2( 151.758, 151.815 ) +[sub_resource type="RectangleShape2D" id="2"] +size = Vector2(250, 300) -[sub_resource type="RectangleShape2D" id=3] -extents = Vector2( 151.758, 94.5276 ) +[sub_resource type="RectangleShape2D" id="3"] +size = Vector2(250, 300) -[sub_resource type="CircleShape2D" id=4] +[sub_resource type="CircleShape2D" id="4"] radius = 225.0 -[sub_resource type="DynamicFont" id=5] -size = 24 -font_data = ExtResource( 2 ) +[sub_resource type="FontFile" id="5"] +fallbacks = Array[Font]([ExtResource("2")]) +cache/0/16/0/ascent = 0.0 +cache/0/16/0/descent = 0.0 +cache/0/16/0/underline_position = 0.0 +cache/0/16/0/underline_thickness = 0.0 +cache/0/16/0/scale = 1.0 +cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0) -[sub_resource type="DynamicFont" id=6] -size = 48 -font_data = ExtResource( 2 ) +[sub_resource type="FontFile" id="6"] +fallbacks = Array[Font]([ExtResource("2")]) +cache/0/16/0/ascent = 0.0 +cache/0/16/0/descent = 0.0 +cache/0/16/0/underline_position = 0.0 +cache/0/16/0/underline_thickness = 0.0 +cache/0/16/0/scale = 1.0 +cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0) [node name="World" type="Node2D"] -script = ExtResource( 1 ) +script = ExtResource("1") [node name="Antigrav" type="Area2D" parent="."] -editor/display_folded = true -position = Vector2( 899.202, 468.526 ) -space_override = 3 -gravity_vec = Vector2( 0, -1 ) -__meta__ = { -"_edit_group_": true -} +position = Vector2(900, 400) +gravity_space_override = 3 +gravity_point_center = Vector2(0, -1) +gravity_direction = Vector2(0, -1) +metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Antigrav"] -shape = SubResource( 2 ) +shape = SubResource("2") [node name="Slow" type="Area2D" parent="."] -editor/display_folded = true -position = Vector2( 590.261, 516.606 ) -space_override = 3 -linear_damp = 10.0 -__meta__ = { -"_edit_group_": true -} +position = Vector2(620, 400) +linear_damp_space_override = 3 +linear_damp = 20.0 +metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Slow"] -shape = SubResource( 3 ) +shape = SubResource("3") [node name="Point" type="Area2D" parent="."] -editor/display_folded = true -position = Vector2( 239.378, 288.481 ) -space_override = 3 +position = Vector2(239.378, 288.481) +gravity_space_override = 1 gravity_point = true -gravity_vec = Vector2( 0, 0 ) -linear_damp = 0.0 -__meta__ = { -"_edit_group_": true -} +gravity_point_center = Vector2(0, 0) +gravity_direction = Vector2(0, 0) +metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Point"] -shape = SubResource( 4 ) +shape = SubResource("4") [node name="Label" type="Label" parent="."] -margin_left = 597.422 -margin_top = 67.5169 -margin_right = 790.422 -margin_bottom = 96.5169 -custom_fonts/font = SubResource( 5 ) +offset_left = 597.422 +offset_top = 67.5169 +offset_right = 790.422 +offset_bottom = 96.5169 +theme_override_fonts/font = SubResource("5") text = "Click to add a ball" [node name="Label5" type="Label" parent="."] +anchors_preset = 5 anchor_left = 0.5 anchor_right = 0.5 -margin_left = 272.555 -margin_top = 11.2528 -margin_right = 793.555 -margin_bottom = 68.2528 -custom_fonts/font = SubResource( 6 ) -text = "Area Override Examples" +offset_left = 272.555 +offset_top = 11.2528 +offset_right = 793.555 +offset_bottom = 68.2528 +theme_override_fonts/font = SubResource("6") +text = "Area3D Override Examples" [node name="Label2" type="Label" parent="."] -margin_left = 172.885 -margin_top = 516.621 -margin_right = 308.885 -margin_bottom = 545.621 -custom_fonts/font = SubResource( 5 ) +offset_left = 172.885 +offset_top = 516.621 +offset_right = 308.885 +offset_bottom = 545.621 +theme_override_fonts/font = SubResource("5") text = "Point gravity" [node name="Label3" type="Label" parent="."] -margin_left = 793.836 -margin_top = 560.609 -margin_right = 960.836 -margin_bottom = 589.609 -custom_fonts/font = SubResource( 5 ) +offset_left = 780.0 +offset_top = 560.0 +offset_right = 947.0 +offset_bottom = 589.0 +theme_override_fonts/font = SubResource("5") text = "Reverse gravity" [node name="Label4" type="Label" parent="."] -margin_left = 519.391 -margin_top = 562.527 -margin_right = 656.391 -margin_bottom = 591.527 -custom_fonts/font = SubResource( 5 ) +offset_left = 500.0 +offset_top = 560.0 +offset_right = 637.0 +offset_bottom = 589.0 +theme_override_fonts/font = SubResource("5") text = "Linear Damp" +vertical_alignment = 1 diff --git a/src/area_2d_starter/assets/Roboto-Bold.ttf.import b/src/area_2d_starter/assets/Roboto-Bold.ttf.import new file mode 100644 index 0000000..c58dac6 --- /dev/null +++ b/src/area_2d_starter/assets/Roboto-Bold.ttf.import @@ -0,0 +1,33 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://sjnahvlt0cil" +path="res://.godot/imported/Roboto-Bold.ttf-ae06ffe7949c1b65f3f7f2503c116443.fontdata" + +[deps] + +source_file="res://assets/Roboto-Bold.ttf" +dest_files=["res://.godot/imported/Roboto-Bold.ttf-ae06ffe7949c1b65f3f7f2503c116443.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/src/area_2d_starter/assets/ballBlue_09.png.import b/src/area_2d_starter/assets/ballBlue_09.png.import index 8f72ac7..24ac5ab 100644 --- a/src/area_2d_starter/assets/ballBlue_09.png.import +++ b/src/area_2d_starter/assets/ballBlue_09.png.import @@ -1,8 +1,9 @@ [remap] importer="texture" -type="StreamTexture" -path="res://.import/ballBlue_09.png-c0bf5b440aad02f790810494f82deb20.stex" +type="CompressedTexture2D" +uid="uid://b2bimjy3075py" +path="res://.godot/imported/ballBlue_09.png-c0bf5b440aad02f790810494f82deb20.ctex" metadata={ "vram_texture": false } @@ -10,25 +11,24 @@ metadata={ [deps] source_file="res://assets/ballBlue_09.png" -dest_files=[ "res://.import/ballBlue_09.png-c0bf5b440aad02f790810494f82deb20.stex" ] +dest_files=["res://.godot/imported/ballBlue_09.png-c0bf5b440aad02f790810494f82deb20.ctex"] [params] compress/mode=0 +compress/high_quality=false compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 +compress/hdr_compression=1 compress/normal_map=0 -flags/repeat=0 -flags/filter=false -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 +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/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=false -svg/scale=1.0 +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/src/area_2d_starter/assets/coin_06.png.import b/src/area_2d_starter/assets/coin_06.png.import index 6d2629d..f3e58e6 100644 --- a/src/area_2d_starter/assets/coin_06.png.import +++ b/src/area_2d_starter/assets/coin_06.png.import @@ -1,8 +1,9 @@ [remap] importer="texture" -type="StreamTexture" -path="res://.import/coin_06.png-68534832945e7874cb02aa1ed58314f9.stex" +type="CompressedTexture2D" +uid="uid://bfu46le40g6f8" +path="res://.godot/imported/coin_06.png-68534832945e7874cb02aa1ed58314f9.ctex" metadata={ "vram_texture": false } @@ -10,25 +11,24 @@ metadata={ [deps] source_file="res://assets/coin_06.png" -dest_files=[ "res://.import/coin_06.png-68534832945e7874cb02aa1ed58314f9.stex" ] +dest_files=["res://.godot/imported/coin_06.png-68534832945e7874cb02aa1ed58314f9.ctex"] [params] compress/mode=0 +compress/high_quality=false compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 +compress/hdr_compression=1 compress/normal_map=0 -flags/repeat=0 -flags/filter=false -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 +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/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 +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/src/area_2d_starter/default_env.tres b/src/area_2d_starter/default_env.tres deleted file mode 100644 index 20207a4..0000000 --- a/src/area_2d_starter/default_env.tres +++ /dev/null @@ -1,7 +0,0 @@ -[gd_resource type="Environment" load_steps=2 format=2] - -[sub_resource type="ProceduralSky" id=1] - -[resource] -background_mode = 2 -background_sky = SubResource( 1 ) diff --git a/src/area_2d_starter/icon.png b/src/area_2d_starter/icon.png deleted file mode 100644 index 2b65815..0000000 Binary files a/src/area_2d_starter/icon.png and /dev/null differ diff --git a/src/area_2d_starter/icon.png.import b/src/area_2d_starter/icon.png.import deleted file mode 100644 index 96cbf46..0000000 --- a/src/area_2d_starter/icon.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://icon.png" -dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/src/area_2d_starter/icon.svg b/src/area_2d_starter/icon.svg new file mode 100644 index 0000000..adc26df --- /dev/null +++ b/src/area_2d_starter/icon.svg @@ -0,0 +1 @@ + diff --git a/src/area_2d_starter/icon.svg.import b/src/area_2d_starter/icon.svg.import new file mode 100644 index 0000000..5229810 --- /dev/null +++ b/src/area_2d_starter/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://mwm6yi7ak504" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/src/area_2d_starter/project.godot b/src/area_2d_starter/project.godot index 9c7ed48..765f8b1 100644 --- a/src/area_2d_starter/project.godot +++ b/src/area_2d_starter/project.godot @@ -6,18 +6,14 @@ ; [section] ; section goes between [] ; param=value ; assign values to parameters -config_version=4 - -_global_script_classes=[ ] -_global_script_class_icons={ - -} +config_version=5 [application] config/name="using_area_2d" run/main_scene="res://World.tscn" -config/icon="res://icon.png" +config/features=PackedStringArray("4.0") +config/icon="res://icon.svg" [importer_defaults] @@ -42,6 +38,6 @@ texture={ "svg/scale": 1.0 } -[rendering] +[physics] -environment/default_environment="res://default_env.tres" +2d/default_gravity=490.0