Step by step - Creating instances
This commit is contained in:
parent
be2e85942e
commit
7c9e657d7a
11 changed files with 309 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
# Godot 4+ specific ignores
|
||||
/Docs/
|
||||
.godot/
|
||||
/android/
|
||||
|
|
BIN
assets/Bouncy Platform Long.png
Normal file
BIN
assets/Bouncy Platform Long.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
34
assets/Bouncy Platform Long.png.import
Normal file
34
assets/Bouncy Platform Long.png.import
Normal file
|
@ -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
|
BIN
assets/Bouncy Platform Medium.png
Normal file
BIN
assets/Bouncy Platform Medium.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
34
assets/Bouncy Platform Medium.png.import
Normal file
34
assets/Bouncy Platform Medium.png.import
Normal file
|
@ -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
|
BIN
assets/ballBlue_10.png
Normal file
BIN
assets/ballBlue_10.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
34
assets/ballBlue_10.png.import
Normal file
34
assets/ballBlue_10.png.import
Normal file
|
@ -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
|
|
@ -11,7 +11,7 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="Godot Docs"
|
||||
run/main_scene="res://scenes/label.tscn"
|
||||
run/main_scene="res://scenes/main.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.png"
|
||||
|
||||
|
@ -22,7 +22,29 @@ version_control/autoload_on_startup=true
|
|||
|
||||
[importer_defaults]
|
||||
|
||||
bitmap={
|
||||
"create_from": 0,
|
||||
"threshold": 0.5
|
||||
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":1,"position":Vector2(295, 13),"global_position":Vector2(304, 59),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
|
20
scenes/ball.tscn
Normal file
20
scenes/ball.tscn
Normal file
|
@ -0,0 +1,20 @@
|
|||
[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"]
|
||||
bounce = 0.5
|
||||
|
||||
[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")
|
151
scenes/main.tscn
Normal file
151
scenes/main.tscn
Normal file
|
@ -0,0 +1,151 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://coq78ajuagqrq"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/main.gd" id="1"]
|
||||
[ext_resource type="PackedScene" uid="uid://dm5jrnxmxnuof" path="res://scenes/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(948.743, 478.292)
|
||||
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(530.235, 200)
|
||||
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(653.325, 204.282)
|
||||
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(1064.67, 326.032)
|
||||
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(215.838, 474.657)
|
||||
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(98, 320.82)
|
||||
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(464.924, 553.519)
|
||||
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(767.458, 554.361)
|
||||
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")
|
||||
|
||||
[node name="Ball" parent="." instance=ExtResource("2")]
|
||||
position = Vector2(456, 110)
|
||||
|
||||
[node name="Ball2" parent="." instance=ExtResource("2")]
|
||||
position = Vector2(300, 97)
|
||||
|
||||
[node name="Ball3" parent="." instance=ExtResource("2")]
|
||||
position = Vector2(204, 171)
|
||||
|
||||
[node name="Ball4" parent="." instance=ExtResource("2")]
|
||||
position = Vector2(805, 107)
|
||||
|
||||
[node name="Ball5" parent="." instance=ExtResource("2")]
|
||||
position = Vector2(987, 130)
|
||||
|
||||
[node name="Ball6" parent="." instance=ExtResource("2")]
|
||||
position = Vector2(701, 81)
|
9
scripts/main.gd
Normal file
9
scripts/main.gd
Normal file
|
@ -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)
|
Loading…
Reference in a new issue