diff --git a/.gitignore b/.gitignore index 6e68499..53b8449 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /docs/ +# Godot 4+ specific ignores +*/.godot/ diff --git a/instancing_starter/Ball.tscn b/instancing_starter/Ball.tscn new file mode 100644 index 0000000..43ab056 --- /dev/null +++ b/instancing_starter/Ball.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=4 format=3 uid="uid://dm5jrnxmxnuof"] + +[ext_resource type="Texture2D" uid="uid://dv6rx85s1gy3i" path="res://assets/ballBlue_10.png" id="1"] + +[sub_resource type="PhysicsMaterial" id="1"] + +[sub_resource type="CircleShape2D" id="2"] +radius = 37.1452 + +[node name="Ball" type="RigidBody2D"] +physics_material_override = SubResource("1") +gravity_scale = 4.0 + +[node name="Sprite2D" type="Sprite2D" parent="."] +scale = Vector2(0.5, 0.5) +texture = ExtResource("1") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("2") diff --git a/instancing_starter/Main.gd b/instancing_starter/Main.gd new file mode 100644 index 0000000..b9d468c --- /dev/null +++ b/instancing_starter/Main.gd @@ -0,0 +1,9 @@ +extends Node + +@export var Ball: PackedScene + +func _input(event): + if event.is_action_pressed("click"): + var new_ball = Ball.instantiate() + new_ball.position = get_viewport().get_mouse_position() + add_child(new_ball) diff --git a/instancing_starter/Main.tscn b/instancing_starter/Main.tscn new file mode 100644 index 0000000..dd9c705 --- /dev/null +++ b/instancing_starter/Main.tscn @@ -0,0 +1,133 @@ +[gd_scene load_steps=13 format=3 uid="uid://bc04jgq832nvc"] + +[ext_resource type="Script" path="res://Main.gd" id="1"] +[ext_resource type="PackedScene" uid="uid://dm5jrnxmxnuof" path="res://Ball.tscn" id="2"] +[ext_resource type="Texture2D" uid="uid://dkq1swbmmxmbq" path="res://assets/Bouncy Platform Long.png" id="3"] + +[sub_resource type="PhysicsMaterial" id="1"] +bounce = 0.5 + +[sub_resource type="CapsuleShape2D" id="2"] +radius = 28.7617 +height = 309.37 + +[sub_resource type="PhysicsMaterial" id="3"] +bounce = 0.5 + +[sub_resource type="PhysicsMaterial" id="4"] +bounce = 0.5 + +[sub_resource type="PhysicsMaterial" id="5"] +bounce = 0.5 + +[sub_resource type="PhysicsMaterial" id="6"] +bounce = 0.5 + +[sub_resource type="PhysicsMaterial" id="7"] +bounce = 0.5 + +[sub_resource type="PhysicsMaterial" id="8"] +bounce = 0.5 + +[sub_resource type="PhysicsMaterial" id="9"] +bounce = 0.5 + +[node name="Main" type="Node"] +script = ExtResource("1") +Ball = ExtResource("2") + +[node name="WallContainer" type="Node" parent="."] + +[node name="Wall2" type="StaticBody2D" parent="WallContainer"] +position = Vector2(880.952, 495.157) +rotation = -0.264907 +physics_material_override = SubResource("1") + +[node name="Sprite2D" type="Sprite2D" parent="WallContainer/Wall2"] +texture = ExtResource("3") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="WallContainer/Wall2"] +rotation = 1.5708 +shape = SubResource("2") + +[node name="Wall7" type="StaticBody2D" parent="WallContainer"] +position = Vector2(462.444, 216.865) +rotation = -1.02983 +physics_material_override = SubResource("3") + +[node name="Sprite2D" type="Sprite2D" parent="WallContainer/Wall7"] +texture = ExtResource("3") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="WallContainer/Wall7"] +rotation = 1.5708 +shape = SubResource("2") + +[node name="Wall8" type="StaticBody2D" parent="WallContainer"] +position = Vector2(585.534, 221.147) +rotation = 1.07416 +physics_material_override = SubResource("4") + +[node name="Sprite2D" type="Sprite2D" parent="WallContainer/Wall8"] +texture = ExtResource("3") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="WallContainer/Wall8"] +rotation = 1.5708 +shape = SubResource("2") + +[node name="Wall4" type="StaticBody2D" parent="WallContainer"] +position = Vector2(996.874, 342.897) +rotation = -1.5708 +physics_material_override = SubResource("5") + +[node name="Sprite2D" type="Sprite2D" parent="WallContainer/Wall4"] +texture = ExtResource("3") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="WallContainer/Wall4"] +rotation = 1.5708 +shape = SubResource("2") + +[node name="Wall1" type="StaticBody2D" parent="WallContainer"] +position = Vector2(148.047, 491.522) +rotation = 0.315662 +physics_material_override = SubResource("6") + +[node name="Sprite2D" type="Sprite2D" parent="WallContainer/Wall1"] +texture = ExtResource("3") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="WallContainer/Wall1"] +rotation = 1.5708 +shape = SubResource("2") + +[node name="Wall5" type="StaticBody2D" parent="WallContainer"] +position = Vector2(30.2087, 337.685) +rotation = 1.5708 +physics_material_override = SubResource("7") + +[node name="Sprite2D" type="Sprite2D" parent="WallContainer/Wall5"] +texture = ExtResource("3") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="WallContainer/Wall5"] +rotation = 1.5708 +shape = SubResource("2") + +[node name="Wall3" type="StaticBody2D" parent="WallContainer"] +position = Vector2(397.133, 570.384) +physics_material_override = SubResource("8") + +[node name="Sprite2D" type="Sprite2D" parent="WallContainer/Wall3"] +texture = ExtResource("3") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="WallContainer/Wall3"] +rotation = 1.5708 +shape = SubResource("2") + +[node name="Wall6" type="StaticBody2D" parent="WallContainer"] +position = Vector2(699.667, 571.226) +physics_material_override = SubResource("9") + +[node name="Sprite2D" type="Sprite2D" parent="WallContainer/Wall6"] +texture = ExtResource("3") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="WallContainer/Wall6"] +rotation = 1.5708 +shape = SubResource("2") diff --git a/instancing_starter/README.md b/instancing_starter/README.md new file mode 100644 index 0000000..9656d83 --- /dev/null +++ b/instancing_starter/README.md @@ -0,0 +1,5 @@ +# Instancing project starter + +Used by the "Step by step" tutorial: + +https://docs.godotengine.org/en/latest/getting_started/step_by_step/index.html diff --git a/instancing_starter/assets/Bouncy Platform Long.png b/instancing_starter/assets/Bouncy Platform Long.png new file mode 100644 index 0000000..aca8330 Binary files /dev/null and b/instancing_starter/assets/Bouncy Platform Long.png differ diff --git a/instancing_starter/assets/Bouncy Platform Long.png.import b/instancing_starter/assets/Bouncy Platform Long.png.import new file mode 100644 index 0000000..6c8f690 --- /dev/null +++ b/instancing_starter/assets/Bouncy Platform Long.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dkq1swbmmxmbq" +path="res://.godot/imported/Bouncy Platform Long.png-9b2628c180785c5ec622adb5c4ee7b17.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Bouncy Platform Long.png" +dest_files=["res://.godot/imported/Bouncy Platform Long.png-9b2628c180785c5ec622adb5c4ee7b17.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/instancing_starter/assets/Bouncy Platform Medium.png b/instancing_starter/assets/Bouncy Platform Medium.png new file mode 100644 index 0000000..f256404 Binary files /dev/null and b/instancing_starter/assets/Bouncy Platform Medium.png differ diff --git a/instancing_starter/assets/Bouncy Platform Medium.png.import b/instancing_starter/assets/Bouncy Platform Medium.png.import new file mode 100644 index 0000000..03dcd2b --- /dev/null +++ b/instancing_starter/assets/Bouncy Platform Medium.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://blqm0e7gm75u3" +path="res://.godot/imported/Bouncy Platform Medium.png-7896338a5f44da1e83084c154a3c4a9e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Bouncy Platform Medium.png" +dest_files=["res://.godot/imported/Bouncy Platform Medium.png-7896338a5f44da1e83084c154a3c4a9e.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/instancing_starter/assets/ballBlue_10.png b/instancing_starter/assets/ballBlue_10.png new file mode 100644 index 0000000..caa9c2b Binary files /dev/null and b/instancing_starter/assets/ballBlue_10.png differ diff --git a/instancing_starter/assets/ballBlue_10.png.import b/instancing_starter/assets/ballBlue_10.png.import new file mode 100644 index 0000000..936661b --- /dev/null +++ b/instancing_starter/assets/ballBlue_10.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dv6rx85s1gy3i" +path="res://.godot/imported/ballBlue_10.png-a6ac20f1eeff46860499a0f8c7bba4ff.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ballBlue_10.png" +dest_files=["res://.godot/imported/ballBlue_10.png-a6ac20f1eeff46860499a0f8c7bba4ff.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/instancing_starter/icon.svg b/instancing_starter/icon.svg new file mode 100644 index 0000000..adc26df --- /dev/null +++ b/instancing_starter/icon.svg @@ -0,0 +1 @@ + diff --git a/instancing_starter/icon.svg.import b/instancing_starter/icon.svg.import new file mode 100644 index 0000000..4d5fc7c --- /dev/null +++ b/instancing_starter/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dlj0lug17ph0p" +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/instancing_starter/project.godot b/instancing_starter/project.godot new file mode 100644 index 0000000..5d24ccf --- /dev/null +++ b/instancing_starter/project.godot @@ -0,0 +1,45 @@ +; 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="instancing" +run/main_scene="res://Main.tscn" +config/features=PackedStringArray("4.0") +config/icon="res://icon.svg" + +[importer_defaults] + +texture={ +"compress/hdr_mode": 0, +"compress/lossy_quality": 0.7, +"compress/mode": 0, +"compress/normal_map": 0, +"detect_3d": true, +"flags/anisotropic": false, +"flags/filter": false, +"flags/mipmaps": false, +"flags/repeat": 0, +"flags/srgb": 2, +"process/HDR_as_SRGB": false, +"process/fix_alpha_border": true, +"process/premult_alpha": false, +"size_limit": 0, +"stream": false, +"svg/scale": 1.0 +} + +[input] + +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,"pressed":false,"double_click":false,"script":null) +] +}