Browse Source

Use inheritance for heroes's actual scenes (tscn)

I didn't know you can do this. It's really, really nice! I can change
properties, hide, and add, to the player scene.

https://github.com/godotengine/godot/issues/3352
master
Luna 7 years ago
parent
commit
6acf045ec5
4 changed files with 54 additions and 431 deletions
  1. +5
    -130
      scenes/heroes/0.tscn
  2. +6
    -138
      scenes/heroes/1.tscn
  3. +13
    -145
      scenes/heroes/2.tscn
  4. +30
    -18
      scenes/player.tscn

+ 5
- 130
scenes/heroes/0.tscn View File

@ -1,135 +1,10 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://scripts/heroes/0.gd" type="Script" id=1]
[ext_resource path="res://scenes/player.tscn" type="PackedScene" id=1]
[ext_resource path="res://scripts/heroes/0.gd" type="Script" id=2]
[sub_resource type="CapsuleShape" id=1]
[node name="RigidBody" index="0" instance=ExtResource( 1 )]
radius = 0.4
height = 0.5
[sub_resource type="RayShape" id=2]
length = 0.3
_sections_unfolded = [ "Resource" ]
[sub_resource type="CapsuleMesh" id=3]
radius = 0.4
mid_height = 0.5
radial_segments = 64
rings = 8
_sections_unfolded = [ "Resource" ]
[node name="RigidBody" type="RigidBody" groups=[
"player",
]]
input_ray_pickable = true
input_capture_on_drag = false
collision_layer = 1
collision_mask = 1
mode = 2
mass = 100.0
friction = 1.0
bounce = 0.0
gravity_scale = 1.0
custom_integrator = false
continuous_cd = true
contacts_reported = 4
contact_monitor = true
sleeping = false
can_sleep = true
axis_lock_linear_x = false
axis_lock_linear_y = false
axis_lock_linear_z = false
axis_lock_angular_x = false
axis_lock_angular_y = false
axis_lock_angular_z = false
linear_velocity = Vector3( 0, 0, 0 )
linear_damp = -1.0
angular_velocity = Vector3( 0, 0, 0 )
angular_damp = -1.0
script = ExtResource( 1 )
_sections_unfolded = [ "Angular", "Collision", "Linear", "Transform", "Visibility" ]
[node name="Body" type="CollisionShape" parent="." index="0"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.95, 0 )
shape = SubResource( 1 )
disabled = false
_sections_unfolded = [ "Pause", "Transform", "Visibility" ]
[node name="Leg" type="CollisionShape" parent="." index="1"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0.05, 0.35, 0 )
shape = SubResource( 2 )
disabled = false
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Ray" type="RayCast" parent="." index="2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0 )
enabled = true
exclude_parent = true
cast_to = Vector3( 0, -0.3, 0 )
collision_mask = 1
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Yaw" type="Spatial" parent="." index="3"]
[node name="Pitch" type="Spatial" parent="Yaw" index="0"]
[node name="Camera" type="Camera" parent="Yaw/Pitch" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, 0 )
keep_aspect = 0
cull_mask = 1048575
environment = null
h_offset = 0.0
v_offset = 0.0
doppler_tracking = 0
projection = 0
current = false
fov = 70.0
size = 1.0
near = 0.05
far = 100.0
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Crosshair" type="Label" parent="." index="4"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -20.0
margin_top = -7.0
margin_right = 20.0
margin_bottom = 7.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="MeshInstance" type="MeshInstance" parent="." index="5"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.95, 0 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 3 )
skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]
script = ExtResource( 2 )

+ 6
- 138
scenes/heroes/1.tscn View File

@ -1,146 +1,14 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://scripts/heroes/1.gd" type="Script" id=1]
[ext_resource path="res://scenes/player.tscn" type="PackedScene" id=1]
[ext_resource path="res://scripts/heroes/1.gd" type="Script" id=2]
[sub_resource type="CapsuleShape" id=1]
[node name="RigidBody" instance=ExtResource( 1 )]
radius = 0.4
height = 0.5
script = ExtResource( 2 )
[sub_resource type="RayShape" id=2]
[node name="Yaw" parent="." index="3"]
length = 0.3
_sections_unfolded = [ "Resource" ]
[sub_resource type="CapsuleMesh" id=3]
radius = 0.4
mid_height = 0.5
radial_segments = 64
rings = 8
_sections_unfolded = [ "Resource" ]
[node name="RigidBody" type="RigidBody" index="0" groups=[
"player",
]]
input_ray_pickable = true
input_capture_on_drag = false
collision_layer = 1
collision_mask = 1
mode = 2
mass = 200.0
friction = 1.0
bounce = 0.0
gravity_scale = 1.0
custom_integrator = false
continuous_cd = true
contacts_reported = 0
contact_monitor = false
sleeping = false
can_sleep = true
axis_lock_linear_x = false
axis_lock_linear_y = false
axis_lock_linear_z = false
axis_lock_angular_x = false
axis_lock_angular_y = false
axis_lock_angular_z = false
linear_velocity = Vector3( 0, 0, 0 )
linear_damp = -1.0
angular_velocity = Vector3( 0, 0, 0 )
angular_damp = -1.0
script = ExtResource( 1 )
_sections_unfolded = [ "Angular", "Axis Lock", "Collision", "Linear", "Transform", "Visibility", "collision" ]
[node name="Crosshair" type="Label" parent="." index="0"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -20.0
margin_top = -7.0
margin_right = 20.0
margin_bottom = 7.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "+"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="Body" type="CollisionShape" parent="." index="1"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.95, 0 )
shape = SubResource( 1 )
disabled = false
_sections_unfolded = [ "Pause", "Transform", "Visibility" ]
[node name="Leg" type="CollisionShape" parent="." index="2"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0.05, 0.35, 0 )
shape = SubResource( 2 )
disabled = false
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Ray" type="RayCast" parent="." index="3"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0 )
enabled = true
exclude_parent = true
cast_to = Vector3( 0, -0.3, 0 )
collision_mask = 1
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Yaw" type="Spatial" parent="." index="4"]
[node name="Pitch" type="Spatial" parent="Yaw" index="0"]
[node name="Camera" type="Camera" parent="Yaw/Pitch" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, 0 )
keep_aspect = 0
cull_mask = 1048575
environment = null
h_offset = 0.0
v_offset = 0.0
doppler_tracking = 0
projection = 0
current = false
fov = 70.0
size = 1.0
near = 0.05
far = 100.0
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Ray" type="RayCast" parent="Yaw/Pitch" index="1"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, 0 )
enabled = true
exclude_parent = true
cast_to = Vector3( 0, 0, -100 )
collision_mask = 1
_sections_unfolded = [ "Transform" ]
[node name="MeshInstance" type="MeshInstance" parent="." index="5"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.95, 0 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 3 )
skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]

+ 13
- 145
scenes/heroes/2.tscn View File

@ -1,152 +1,41 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scripts/heroes/2.gd" type="Script" id=1]
[sub_resource type="CapsuleShape" id=1]
radius = 0.4
height = 0.5
[sub_resource type="RayShape" id=2]
length = 0.3
_sections_unfolded = [ "Resource" ]
[sub_resource type="CapsuleMesh" id=3]
radius = 0.4
mid_height = 0.5
radial_segments = 64
rings = 8
_sections_unfolded = [ "Resource" ]
[ext_resource path="res://scenes/player.tscn" type="PackedScene" id=1]
[ext_resource path="res://scripts/heroes/2.gd" type="Script" id=2]
[sub_resource type="SphereShape" id=4]
radius = 7.0
[node name="RigidBody" type="RigidBody" index="0" groups=[
"player",
]]
[node name="RigidBody" instance=ExtResource( 1 )]
input_ray_pickable = true
input_capture_on_drag = false
collision_layer = 4
collision_mask = 1
mode = 2
mass = 200.0
friction = 1.0
bounce = 0.0
gravity_scale = 1.0
custom_integrator = false
continuous_cd = true
contacts_reported = 0
contact_monitor = false
sleeping = false
can_sleep = true
axis_lock_linear_x = false
axis_lock_linear_y = false
axis_lock_linear_z = false
axis_lock_angular_x = false
axis_lock_angular_y = false
axis_lock_angular_z = false
linear_velocity = Vector3( 0, 0, 0 )
linear_damp = -1.0
angular_velocity = Vector3( 0, 0, 0 )
angular_damp = -1.0
script = ExtResource( 1 )
_sections_unfolded = [ "Angular", "Axis Lock", "Collision", "Linear", "Transform", "Visibility", "collision" ]
script = ExtResource( 2 )
[node name="Crosshair" parent="MasterOnly" index="0"]
[node name="Crosshair" type="Label" parent="." index="0"]
text = ""
[node name="RepellingHUD" type="Label" parent="MasterOnly" index="1"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -20.0
margin_top = -7.0
margin_top = -34.0
margin_right = 20.0
margin_bottom = 7.0
margin_bottom = -20.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "+"
text = "\\/"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="Body" type="CollisionShape" parent="." index="1"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.95, 0 )
shape = SubResource( 1 )
disabled = false
_sections_unfolded = [ "Pause", "Transform", "Visibility" ]
[node name="Leg" type="CollisionShape" parent="." index="2"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0.05, 0.35, 0 )
shape = SubResource( 2 )
disabled = false
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Ray" type="RayCast" parent="." index="3"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0 )
enabled = true
exclude_parent = true
cast_to = Vector3( 0, -0.3, 0 )
collision_mask = 1
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Yaw" type="Spatial" parent="." index="4"]
[node name="Pitch" type="Spatial" parent="Yaw" index="0"]
[node name="Camera" type="Camera" parent="Yaw/Pitch" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, 0 )
keep_aspect = 0
cull_mask = 1048575
environment = null
h_offset = 0.0
v_offset = 0.0
doppler_tracking = 0
projection = 0
current = false
fov = 70.0
size = 1.0
near = 0.05
far = 100.0
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Ray" type="RayCast" parent="Yaw/Pitch" index="1"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, 0 )
enabled = true
exclude_parent = true
cast_to = Vector3( 0, 0, -100 )
collision_mask = 1
_sections_unfolded = [ "Transform" ]
[node name="MeshInstance" type="MeshInstance" parent="." index="5"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.95, 0 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 3 )
skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]
[node name="Area" type="Area" parent="." index="6"]
input_ray_pickable = false
@ -176,25 +65,4 @@ _sections_unfolded = [ "Audio Bus", "Collision", "Pause", "Reverb Bus", "Transfo
shape = SubResource( 4 )
disabled = false
[node name="RepellingHUD" type="Label" parent="." index="7"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -20.0
margin_top = -34.0
margin_right = 20.0
margin_bottom = -20.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "\\/"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1

+ 30
- 18
scenes/player.tscn View File

@ -96,7 +96,35 @@ near = 0.05
far = 100.0
_sections_unfolded = [ "Transform", "Visibility" ]
[node name="Crosshair" type="Label" parent="." index="4"]
[node name="Ray" type="RayCast" parent="Yaw/Pitch" index="1"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, 0 )
enabled = true
exclude_parent = true
cast_to = Vector3( 0, 0, -100 )
collision_mask = 1
_sections_unfolded = [ "Transform" ]
[node name="MeshInstance" type="MeshInstance" parent="." index="4"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.95, 0 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 3 )
skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]
[node name="MasterOnly" type="Node" parent="." index="5"]
[node name="Crosshair" type="Label" parent="MasterOnly" index="0"]
anchor_left = 0.5
anchor_top = 0.5
@ -116,22 +144,6 @@ align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="MeshInstance" type="MeshInstance" parent="." index="5"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.95, 0 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 3 )
skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]
_sections_unfolded = [ "Anchor", "Margin", "Rect" ]

Loading…
Cancel
Save