-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added trampoline object with functionality and sound, added customiza…
…ble limits to camera vertical movement
- Loading branch information
1 parent
6bbf593
commit e265046
Showing
6 changed files
with
150 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
extends Node3D | ||
@export var trampoline_strength : float = 10 | ||
@onready var trampoline_audio_stream_player_3d: AudioStreamPlayer3D = $TrampolineAudioStreamPlayer3D | ||
@onready var trampoline_animation_player: AnimationPlayer = $TrampolineAnimationPlayer | ||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready() -> void: | ||
pass # Replace with function body. | ||
|
||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta: float) -> void: | ||
pass | ||
|
||
|
||
func _on_area_3d_body_entered(body: Node3D) -> void: | ||
if body.has_method("bounce_player"): | ||
body.bounce_player(trampoline_strength) | ||
trampoline_audio_stream_player_3d.play() | ||
trampoline_animation_player.play("bounce") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
[gd_scene load_steps=9 format=3 uid="uid://ytqajrdi7fqj"] | ||
|
||
[ext_resource type="Script" path="res://objects/trampoline.gd" id="1_73nxn"] | ||
[ext_resource type="AudioStream" uid="uid://c74thugcgcetg" path="res://sounds/trampoline_bounce.mp3" id="3_0nmjc"] | ||
[ext_resource type="PackedScene" uid="uid://1hx4wcwosemd" path="res://models/props/block-moving-large.glb" id="3_lbpl7"] | ||
|
||
[sub_resource type="BoxShape3D" id="BoxShape3D_t50jv"] | ||
size = Vector3(2, 0.5, 2) | ||
|
||
[sub_resource type="BoxShape3D" id="BoxShape3D_rnm3k"] | ||
size = Vector3(1.75, 0.5, 1.75) | ||
|
||
[sub_resource type="Animation" id="Animation_1iltb"] | ||
resource_name = "bounce" | ||
length = 0.3 | ||
tracks/0/type = "value" | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/path = NodePath("block-extended:visible") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/keys = { | ||
"times": PackedFloat32Array(0, 0.3), | ||
"transitions": PackedFloat32Array(1, 1), | ||
"update": 1, | ||
"values": [true, true] | ||
} | ||
tracks/1/type = "value" | ||
tracks/1/imported = false | ||
tracks/1/enabled = true | ||
tracks/1/path = NodePath("block-extended:scale") | ||
tracks/1/interp = 1 | ||
tracks/1/loop_wrap = true | ||
tracks/1/keys = { | ||
"times": PackedFloat32Array(0, 0.1, 0.133333, 0.166667, 0.266667, 0.3), | ||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), | ||
"update": 0, | ||
"values": [Vector3(2, 1, 2), Vector3(1.75, 2, 1.75), Vector3(1.75, 2.1, 1.75), Vector3(1.75, 2, 1.75), Vector3(2.25, 0.9, 2.25), Vector3(2, 1, 2)] | ||
} | ||
|
||
[sub_resource type="Animation" id="Animation_hgpsv"] | ||
length = 0.001 | ||
tracks/0/type = "value" | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/path = NodePath("block-extended:visible") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/keys = { | ||
"times": PackedFloat32Array(0), | ||
"transitions": PackedFloat32Array(1), | ||
"update": 1, | ||
"values": [true] | ||
} | ||
tracks/1/type = "value" | ||
tracks/1/imported = false | ||
tracks/1/enabled = true | ||
tracks/1/path = NodePath("block-extended:scale") | ||
tracks/1/interp = 1 | ||
tracks/1/loop_wrap = true | ||
tracks/1/keys = { | ||
"times": PackedFloat32Array(0), | ||
"transitions": PackedFloat32Array(1), | ||
"update": 0, | ||
"values": [Vector3(2, 1, 2)] | ||
} | ||
|
||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_leh4b"] | ||
_data = { | ||
"RESET": SubResource("Animation_hgpsv"), | ||
"bounce": SubResource("Animation_1iltb") | ||
} | ||
|
||
[node name="trampoline" type="Node3D"] | ||
script = ExtResource("1_73nxn") | ||
|
||
[node name="StaticBody3D" type="StaticBody3D" parent="."] | ||
|
||
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"] | ||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0) | ||
shape = SubResource("BoxShape3D_t50jv") | ||
|
||
[node name="Area3D" type="Area3D" parent="."] | ||
collision_mask = 2 | ||
monitorable = false | ||
|
||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"] | ||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.425, 0) | ||
shape = SubResource("BoxShape3D_rnm3k") | ||
|
||
[node name="TrampolineAudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."] | ||
stream = ExtResource("3_0nmjc") | ||
|
||
[node name="block-extended" parent="." instance=ExtResource("3_lbpl7")] | ||
transform = Transform3D(2, 0, 0, 0, 1, 0, 0, 0, 2, 0, -0.1, 0) | ||
|
||
[node name="TrampolineAnimationPlayer" type="AnimationPlayer" parent="."] | ||
libraries = { | ||
"": SubResource("AnimationLibrary_leh4b") | ||
} | ||
|
||
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[remap] | ||
|
||
importer="mp3" | ||
type="AudioStreamMP3" | ||
uid="uid://c74thugcgcetg" | ||
path="res://.godot/imported/trampoline_bounce.mp3-7a92a5c42b3b5ed5ed4ee2b1090fb950.mp3str" | ||
|
||
[deps] | ||
|
||
source_file="res://sounds/trampoline_bounce.mp3" | ||
dest_files=["res://.godot/imported/trampoline_bounce.mp3-7a92a5c42b3b5ed5ed4ee2b1090fb950.mp3str"] | ||
|
||
[params] | ||
|
||
loop=false | ||
loop_offset=0 | ||
bpm=0 | ||
beat_count=0 | ||
bar_beats=4 |