mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 14:10:55 +03:00
Update 3D Platformer for 4.0 (#770)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
extends Area3D
|
||||
|
||||
|
||||
var taken = false
|
||||
|
||||
|
||||
func _on_coin_body_enter(body):
|
||||
if not taken and body is preload("res://player/player.gd"):
|
||||
get_node(^"Animation").play("take")
|
||||
if not taken and body is Player:
|
||||
$Animation.play(&"take")
|
||||
taken = true
|
||||
|
||||
@@ -1,59 +1,81 @@
|
||||
[gd_scene load_steps=12 format=2]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://dfxo2jwbj4aeh"]
|
||||
|
||||
[ext_resource path="res://coin/coin.gd" type="Script" id=1]
|
||||
[ext_resource path="res://coin/sound_coin.wav" type="AudioStream" id=2]
|
||||
[ext_resource path="res://enemy/shine.png" type="Texture2D" id=3]
|
||||
[ext_resource type="Script" path="res://coin/coin.gd" id="1"]
|
||||
[ext_resource type="AudioStream" uid="uid://b23l5nfatq2d2" path="res://coin/sound_coin.wav" id="2"]
|
||||
[ext_resource type="Material" uid="uid://dp0bangabfrg" path="res://coin/coin_material.tres" id="2_n0rbc"]
|
||||
[ext_resource type="Texture2D" uid="uid://y3opjgnv67r8" path="res://particle.png" id="3"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id=1]
|
||||
albedo_color = Color(1, 0.837686, 0, 1)
|
||||
metallic = 0.86
|
||||
roughness = 0.0
|
||||
emission_enabled = true
|
||||
emission = Color(0.219922, 0.109961, 0, 1)
|
||||
emission_energy = 1.71
|
||||
emission_operator = 0
|
||||
emission_on_uv2 = false
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_fpglg"]
|
||||
top_radius = 0.2
|
||||
bottom_radius = 0.2
|
||||
height = 0.05
|
||||
radial_segments = 16
|
||||
rings = 1
|
||||
|
||||
[sub_resource type="ArrayMesh" id=2]
|
||||
resource_name = "Circle"
|
||||
surfaces/0 = {
|
||||
"aabb": AABB(-1, -0.191052, -1, 2, 0.407182, 2.64929),
|
||||
"array_data": PackedByteArray(0, 184, 29, 178, 237, 186, 0, 60, 0, 130, 0, 0, 0, 0, 29, 178, 255, 187, 0, 60, 0, 130, 0, 0, 255, 55, 29, 178, 237, 186, 0, 60, 0, 130, 0, 0, 237, 58, 29, 178, 0, 184, 0, 60, 0, 130, 0, 0, 237, 186, 29, 178, 255, 183, 0, 60, 0, 130, 0, 0, 0, 60, 29, 178, 0, 0, 0, 60, 0, 130, 0, 0, 0, 188, 29, 178, 0, 0, 0, 60, 0, 130, 0, 0, 0, 60, 29, 178, 49, 57, 0, 60, 0, 130, 0, 0, 0, 188, 29, 178, 49, 57, 0, 60, 0, 130, 0, 0, 237, 58, 29, 178, 152, 60, 0, 60, 0, 130, 0, 0, 237, 186, 29, 178, 152, 60, 0, 60, 0, 130, 0, 0, 0, 56, 29, 178, 15, 62, 0, 60, 0, 130, 0, 0, 0, 184, 29, 178, 15, 62, 0, 60, 0, 130, 0, 0, 0, 0, 29, 178, 152, 62, 0, 60, 0, 130, 0, 0, 255, 55, 234, 50, 237, 186, 0, 60, 0, 127, 0, 0, 0, 0, 234, 50, 255, 187, 0, 60, 0, 127, 0, 0, 0, 184, 234, 50, 237, 186, 0, 60, 0, 127, 0, 0, 237, 58, 234, 50, 0, 184, 0, 60, 0, 127, 0, 0, 237, 186, 234, 50, 255, 183, 0, 60, 0, 127, 0, 0, 0, 60, 234, 50, 0, 0, 0, 60, 0, 127, 0, 0, 0, 188, 234, 50, 0, 0, 0, 60, 0, 127, 0, 0, 0, 60, 234, 50, 49, 57, 0, 60, 0, 127, 0, 0, 0, 188, 234, 50, 49, 57, 0, 60, 0, 127, 0, 0, 237, 58, 234, 50, 152, 60, 0, 60, 0, 127, 0, 0, 237, 186, 234, 50, 152, 60, 0, 60, 0, 127, 0, 0, 0, 56, 234, 50, 15, 62, 0, 60, 0, 127, 0, 0, 0, 184, 234, 50, 15, 62, 0, 60, 0, 127, 0, 0, 0, 0, 234, 50, 152, 62, 0, 60, 0, 127, 0, 0, 0, 0, 29, 178, 152, 62, 0, 60, 0, 0, 126, 0, 0, 0, 234, 50, 152, 62, 0, 60, 0, 0, 126, 0, 0, 184, 234, 50, 15, 62, 0, 60, 193, 0, 109, 0, 0, 184, 29, 178, 15, 62, 0, 60, 193, 0, 109, 0, 0, 0, 29, 178, 255, 187, 0, 60, 0, 0, 129, 0, 0, 0, 234, 50, 255, 187, 0, 60, 0, 0, 129, 0, 255, 55, 234, 50, 237, 186, 0, 60, 63, 0, 147, 0, 255, 55, 29, 178, 237, 186, 0, 60, 63, 0, 147, 0, 237, 186, 234, 50, 152, 60, 0, 60, 147, 0, 63, 0, 237, 186, 29, 178, 152, 60, 0, 60, 147, 0, 63, 0, 237, 58, 234, 50, 0, 184, 0, 60, 109, 0, 193, 0, 237, 58, 29, 178, 0, 184, 0, 60, 109, 0, 193, 0, 0, 188, 234, 50, 49, 57, 0, 60, 131, 0, 16, 0, 0, 188, 29, 178, 49, 57, 0, 60, 131, 0, 16, 0, 0, 60, 234, 50, 0, 0, 0, 60, 125, 0, 240, 0, 0, 60, 29, 178, 0, 0, 0, 60, 125, 0, 240, 0, 0, 60, 29, 178, 49, 57, 0, 60, 125, 0, 16, 0, 0, 60, 234, 50, 49, 57, 0, 60, 125, 0, 16, 0, 237, 58, 234, 50, 152, 60, 0, 60, 109, 0, 63, 0, 237, 58, 29, 178, 152, 60, 0, 60, 109, 0, 63, 0, 0, 188, 29, 178, 0, 0, 0, 60, 131, 0, 240, 0, 0, 188, 234, 50, 0, 0, 0, 60, 131, 0, 240, 0, 237, 186, 234, 50, 255, 183, 0, 60, 147, 0, 193, 0, 237, 186, 29, 178, 255, 183, 0, 60, 147, 0, 193, 0, 0, 56, 234, 50, 15, 62, 0, 60, 63, 0, 109, 0, 0, 56, 29, 178, 15, 62, 0, 60, 63, 0, 109, 0, 0, 184, 234, 50, 237, 186, 0, 60, 193, 0, 147, 0, 0, 184, 29, 178, 237, 186, 0, 60, 193, 0, 147, 0),
|
||||
"array_index_data": PackedByteArray(0, 0, 2, 0, 1, 0, 0, 0, 3, 0, 2, 0, 0, 0, 4, 0, 3, 0, 3, 0, 4, 0, 5, 0, 5, 0, 4, 0, 6, 0, 5, 0, 6, 0, 7, 0, 7, 0, 6, 0, 8, 0, 7, 0, 8, 0, 9, 0, 9, 0, 8, 0, 10, 0, 9, 0, 10, 0, 11, 0, 11, 0, 10, 0, 12, 0, 11, 0, 12, 0, 13, 0, 14, 0, 16, 0, 15, 0, 14, 0, 17, 0, 16, 0, 16, 0, 17, 0, 18, 0, 18, 0, 17, 0, 19, 0, 18, 0, 19, 0, 20, 0, 20, 0, 19, 0, 21, 0, 20, 0, 21, 0, 22, 0, 22, 0, 21, 0, 23, 0, 22, 0, 23, 0, 24, 0, 24, 0, 23, 0, 25, 0, 24, 0, 25, 0, 26, 0, 26, 0, 25, 0, 27, 0, 28, 0, 30, 0, 29, 0, 28, 0, 31, 0, 30, 0, 32, 0, 34, 0, 33, 0, 32, 0, 35, 0, 34, 0, 31, 0, 36, 0, 30, 0, 31, 0, 37, 0, 36, 0, 35, 0, 38, 0, 34, 0, 35, 0, 39, 0, 38, 0, 37, 0, 40, 0, 36, 0, 37, 0, 41, 0, 40, 0, 39, 0, 42, 0, 38, 0, 39, 0, 43, 0, 42, 0, 44, 0, 46, 0, 45, 0, 44, 0, 47, 0, 46, 0, 48, 0, 50, 0, 49, 0, 48, 0, 51, 0, 50, 0, 47, 0, 52, 0, 46, 0, 47, 0, 53, 0, 52, 0, 44, 0, 42, 0, 43, 0, 44, 0, 45, 0, 42, 0, 51, 0, 54, 0, 50, 0, 51, 0, 55, 0, 54, 0, 53, 0, 29, 0, 52, 0, 53, 0, 28, 0, 29, 0, 41, 0, 49, 0, 40, 0, 41, 0, 48, 0, 49, 0, 55, 0, 33, 0, 54, 0, 55, 0, 32, 0, 33, 0),
|
||||
"blend_shape_data": [],
|
||||
"format": 98051,
|
||||
"index_count": 156,
|
||||
"material": SubResource( 1 ),
|
||||
"primitive": 4,
|
||||
"skeleton_aabb": [],
|
||||
"vertex_count": 56
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "spin"
|
||||
length = 2.0
|
||||
loop = true
|
||||
[sub_resource type="Animation" id="Animation_r4jod"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Circle:rotation_degrees")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Circle:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(1.5708, 0, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Circle:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
resource_name = "spin"
|
||||
length = 2.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Circle:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(-90, 0, 0), Vector3(-90, 0, -360)]
|
||||
"values": [Vector3(1.5708, 6.28319, 0), Vector3(1.5708, 0, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Circle:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
[sub_resource type="Animation" id="4"]
|
||||
resource_name = "take"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Circle:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
@@ -61,11 +83,11 @@ tracks/0/keys = {
|
||||
"values": [false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("GPUParticles3D:emitting")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
@@ -73,11 +95,11 @@ tracks/1/keys = {
|
||||
"values": [true]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Sound:playing")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
@@ -85,69 +107,73 @@ tracks/2/keys = {
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="SphereShape3D" id=5]
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7v453"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_r4jod"),
|
||||
"spin": SubResource("3"),
|
||||
"take": SubResource("4")
|
||||
}
|
||||
|
||||
[sub_resource type="SphereShape3D" id="5"]
|
||||
radius = 0.312546
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id=6]
|
||||
flags_transparent = true
|
||||
flags_unshaded = true
|
||||
[sub_resource type="StandardMaterial3D" id="6"]
|
||||
transparency = 1
|
||||
blend_mode = 1
|
||||
shading_mode = 0
|
||||
vertex_color_use_as_albedo = true
|
||||
vertex_color_is_srgb = true
|
||||
params_blend_mode = 1
|
||||
params_billboard_mode = 3
|
||||
albedo_color = Color(1, 1, 0.759137, 1)
|
||||
albedo_texture = ExtResource("3")
|
||||
billboard_mode = 3
|
||||
particles_anim_h_frames = 1
|
||||
particles_anim_v_frames = 1
|
||||
particles_anim_loop = false
|
||||
albedo_color = Color(1, 1, 0.759137, 1)
|
||||
albedo_texture = ExtResource( 3 )
|
||||
|
||||
[sub_resource type="QuadMesh" id=7]
|
||||
material = SubResource( 6 )
|
||||
[sub_resource type="PlaneMesh" id="7"]
|
||||
material = SubResource("6")
|
||||
size = Vector2(0.5, 0.5)
|
||||
orientation = 2
|
||||
|
||||
[sub_resource type="Gradient" id=8]
|
||||
[sub_resource type="Gradient" id="8"]
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
|
||||
|
||||
[node name="Coin" type="Area3D"]
|
||||
input_ray_pickable = false
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"__editor_plugin_screen__": "3D"
|
||||
}
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="Circle" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.2, 0, 0, 0, -3.25841e-08, 0.2, 0, -0.2, -3.25841e-08, 0.00550658, 0.532125, 0.000651598)
|
||||
transform = Transform3D(1, 0, 0, 0, -3.61999e-06, -1, 0, 1, -3.61999e-06, 0.00550658, 0.532125, 0.000651598)
|
||||
layers = 2
|
||||
mesh = SubResource( 2 )
|
||||
surface_material_override/0 = null
|
||||
mesh = SubResource("CylinderMesh_fpglg")
|
||||
surface_material_override/0 = ExtResource("2_n0rbc")
|
||||
|
||||
[node name="Animation" type="AnimationPlayer" parent="."]
|
||||
autoplay = "spin"
|
||||
anims/spin = SubResource( 3 )
|
||||
anims/take = SubResource( 4 )
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_7v453")
|
||||
}
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00894194, 0.575859, 0.0193955)
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="VisibleOnScreenEnabler3D" type="VisibleOnScreenEnabler3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0321827, 0.57887, 0.0268312)
|
||||
aabb = AABB(-0.29109, -0.328186, -0.295852, 0.582181, 0.656373, 0.591703)
|
||||
freeze_bodies = false
|
||||
shape = SubResource("5")
|
||||
|
||||
[node name="Sound" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = ExtResource( 2 )
|
||||
stream = ExtResource("2")
|
||||
|
||||
[node name="GPUParticles3D" type="CPUParticles3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.000732422, 0.542954, 0)
|
||||
emitting = false
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
mesh = SubResource( 7 )
|
||||
explosiveness = 0.5
|
||||
lifetime_randomness = 0.2
|
||||
mesh = SubResource("7")
|
||||
emission_shape = 2
|
||||
emission_box_extents = Vector3(0.3, 0.3, 0.3)
|
||||
initial_velocity = 5.51
|
||||
angular_velocity = 4.27461e-05
|
||||
scale_amount = 0.1
|
||||
color_ramp = SubResource( 8 )
|
||||
emission_sphere_radius = 0.4
|
||||
direction = Vector3(0, 1, 0)
|
||||
spread = 25.0
|
||||
initial_velocity_min = 1.0
|
||||
initial_velocity_max = 2.0
|
||||
color_ramp = SubResource("8")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_coin_body_enter"]
|
||||
|
||||
10
3d/platformer/coin/coin_material.tres
Normal file
10
3d/platformer/coin/coin_material.tres
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_resource type="StandardMaterial3D" format=3 uid="uid://dp0bangabfrg"]
|
||||
|
||||
[resource]
|
||||
albedo_color = Color(1, 0.837686, 0, 1)
|
||||
metallic = 1.0
|
||||
roughness = 0.2
|
||||
emission_enabled = true
|
||||
emission = Color(0.219922, 0.109961, 0, 1)
|
||||
anisotropy_enabled = true
|
||||
anisotropy = 1.0
|
||||
@@ -1,7 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://b23l5nfatq2d2"
|
||||
path="res://.godot/imported/sound_coin.wav-5f523c825e94d407ed9e355cbe69ab46.sample"
|
||||
|
||||
[deps]
|
||||
@@ -17,5 +18,7 @@ force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=true
|
||||
edit/normalize=true
|
||||
edit/loop=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
||||
|
||||
Reference in New Issue
Block a user