Implement music playing for slow and normal
This commit is contained in:
parent
3988fc3ff0
commit
af92ebff4b
|
@ -1,6 +1,7 @@
|
||||||
[gd_scene load_steps=22 format=2]
|
[gd_scene load_steps=24 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://3d_platforma/Player.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://3d_platforma/Player.tscn" type="PackedScene" id=1]
|
||||||
|
[ext_resource path="res://Music/slow track.wav" type="AudioStream" id=2]
|
||||||
[ext_resource path="res://scripts/Library/Actions/Snare Admiral 2.wav" type="AudioStream" id=3]
|
[ext_resource path="res://scripts/Library/Actions/Snare Admiral 2.wav" type="AudioStream" id=3]
|
||||||
[ext_resource path="res://3d_platforma/sqare_norm.png" type="Texture" id=4]
|
[ext_resource path="res://3d_platforma/sqare_norm.png" type="Texture" id=4]
|
||||||
[ext_resource path="res://3d_platforma/texture_08.png" type="Texture" id=5]
|
[ext_resource path="res://3d_platforma/texture_08.png" type="Texture" id=5]
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
[ext_resource path="res://scripts/RegisterAudioStreamPlayerSlow.gd" type="Script" id=12]
|
[ext_resource path="res://scripts/RegisterAudioStreamPlayerSlow.gd" type="Script" id=12]
|
||||||
[ext_resource path="res://scripts/RegisterAudioStreamPlayerFast.gd" type="Script" id=13]
|
[ext_resource path="res://scripts/RegisterAudioStreamPlayerFast.gd" type="Script" id=13]
|
||||||
[ext_resource path="res://scripts/RegisterAudioStreamPlayerNormal.gd" type="Script" id=14]
|
[ext_resource path="res://scripts/RegisterAudioStreamPlayerNormal.gd" type="Script" id=14]
|
||||||
|
[ext_resource path="res://Music/godot-project-hiphop.wav" type="AudioStream" id=15]
|
||||||
|
|
||||||
[sub_resource type="SpatialMaterial" id=36]
|
[sub_resource type="SpatialMaterial" id=36]
|
||||||
resource_name = "CheckerGrid"
|
resource_name = "CheckerGrid"
|
||||||
|
@ -215,7 +217,7 @@ autoplay = "move"
|
||||||
anims/move = SubResource( 37 )
|
anims/move = SubResource( 37 )
|
||||||
|
|
||||||
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
||||||
transform = Transform( 0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -0.5, 0.5, 0, 5, 0 )
|
transform = Transform( 0.707107, -0.5, 0.5, 0.00134521, 0.708057, 0.706154, -0.707106, -0.498654, 0.501344, 0, 5, 0 )
|
||||||
light_energy = 0.65
|
light_energy = 0.65
|
||||||
|
|
||||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
@ -241,18 +243,20 @@ script = ExtResource( 1 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="TapeFast" parent="." instance=ExtResource( 9 )]
|
[node name="TapeFast" parent="." instance=ExtResource( 9 )]
|
||||||
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, -1.34058, 6, -1.25926 )
|
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, -1.34058, 0.785612, -1.25926 )
|
||||||
|
|
||||||
[node name="TapeNormal" parent="." instance=ExtResource( 10 )]
|
[node name="TapeNormal" parent="." instance=ExtResource( 10 )]
|
||||||
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0.518271, 6, -1.35086 )
|
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0.518271, 0.785612, -1.35086 )
|
||||||
|
|
||||||
[node name="TapeSlow" parent="." instance=ExtResource( 11 )]
|
[node name="TapeSlow" parent="." instance=ExtResource( 11 )]
|
||||||
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, -0.06, 0.7, -6.3138 )
|
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, -0.06, 0.7, -6.3138 )
|
||||||
|
|
||||||
[node name="AudioStreamPlayer3DSlow" type="AudioStreamPlayer3D" parent="."]
|
[node name="AudioStreamPlayer3DSlow" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource( 2 )
|
||||||
script = ExtResource( 12 )
|
script = ExtResource( 12 )
|
||||||
|
|
||||||
[node name="AudioStreamPlayer3DNormal" type="AudioStreamPlayer3D" parent="."]
|
[node name="AudioStreamPlayer3DNormal" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource( 15 )
|
||||||
script = ExtResource( 14 )
|
script = ExtResource( 14 )
|
||||||
|
|
||||||
[node name="AudioStreamPlayer3DFast" type="AudioStreamPlayer3D" parent="."]
|
[node name="AudioStreamPlayer3DFast" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
|
Binary file not shown.
|
@ -19,6 +19,11 @@ _global_script_classes=[ {
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://scripts/Library/Actions/ActionList.gd"
|
"path": "res://scripts/Library/Actions/ActionList.gd"
|
||||||
}, {
|
}, {
|
||||||
|
"base": "Node",
|
||||||
|
"class": "MusicChangedSlowAction",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://scripts/Library/Actions/MusicChangedSlowAction.gd"
|
||||||
|
}, {
|
||||||
"base": "Action",
|
"base": "Action",
|
||||||
"class": "PlaySound",
|
"class": "PlaySound",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
|
@ -45,6 +50,11 @@ _global_script_classes=[ {
|
||||||
"path": "res://scripts/Library/Actions/TriggerBase.gd"
|
"path": "res://scripts/Library/Actions/TriggerBase.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "TriggerBase",
|
"base": "TriggerBase",
|
||||||
|
"class": "TriggerOnCollision",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://scripts/Library/Actions/TriggerOnCollision.gd"
|
||||||
|
}, {
|
||||||
|
"base": "TriggerBase",
|
||||||
"class": "TriggerOnReady",
|
"class": "TriggerOnReady",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://scripts/Library/Actions/TriggerOnReady.gd"
|
"path": "res://scripts/Library/Actions/TriggerOnReady.gd"
|
||||||
|
@ -52,11 +62,13 @@ _global_script_classes=[ {
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
"Action": "",
|
"Action": "",
|
||||||
"ActionList": "",
|
"ActionList": "",
|
||||||
|
"MusicChangedSlowAction": "",
|
||||||
"PlaySound": "",
|
"PlaySound": "",
|
||||||
"SetFastMusic": "",
|
"SetFastMusic": "",
|
||||||
"SetNormalMusic": "",
|
"SetNormalMusic": "",
|
||||||
"SetSlowMusic": "",
|
"SetSlowMusic": "",
|
||||||
"TriggerBase": "",
|
"TriggerBase": "",
|
||||||
|
"TriggerOnCollision": "",
|
||||||
"TriggerOnReady": ""
|
"TriggerOnReady": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
class_name MusicChangedSlowAction extends Node
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
MusicSingleton.register_change_action(self)
|
||||||
|
|
||||||
|
func _exit_tree():
|
||||||
|
MusicSingleton.unregister_change_action(self)
|
||||||
|
|
||||||
|
func execute() -> void:
|
||||||
|
print("Executed OnMusicChangedSlowAction")
|
|
@ -21,24 +21,49 @@ func setNormalMusic():
|
||||||
setMusicType( 0 )
|
setMusicType( 0 )
|
||||||
|
|
||||||
func setMusicType( type:int ):
|
func setMusicType( type:int ):
|
||||||
|
print("Set Music type")
|
||||||
musicType = type;
|
musicType = type;
|
||||||
|
|
||||||
if type == 0:
|
if type == 0:
|
||||||
gameSpeed = 0
|
gameSpeed = 0
|
||||||
|
|
||||||
# current_playback_position : float = 0.0
|
var current_playback_position : float = 0.0
|
||||||
# if current_audio_player:
|
print("Set Music type normal")
|
||||||
# current_audio_player.stop()
|
|
||||||
# current_playback_position = current_audio_player.get_playback_position()
|
if current_audio_player:
|
||||||
# current_playback_position = current_audio_player.get_playback_position()
|
current_playback_position = current_audio_player.get_playback_position()
|
||||||
# current_playback_position = current_audio_player.get_playback_position()
|
current_audio_player.stop()
|
||||||
|
|
||||||
|
current_audio_player = audio_player_normal
|
||||||
|
current_audio_player.play(current_playback_position)
|
||||||
|
|
||||||
if type == 1:
|
if type == 1:
|
||||||
|
|
||||||
gameSpeed = 2
|
gameSpeed = 2
|
||||||
|
|
||||||
|
var current_playback_position : float = 0.0
|
||||||
|
|
||||||
|
if current_audio_player:
|
||||||
|
current_playback_position = current_audio_player.get_playback_position()
|
||||||
|
current_audio_player.stop()
|
||||||
|
|
||||||
|
current_audio_player = audio_player_fast
|
||||||
|
current_audio_player.play(current_playback_position)
|
||||||
|
|
||||||
if type == -1:
|
if type == -1:
|
||||||
|
print("Set Music type slow")
|
||||||
|
|
||||||
gameSpeed = 0.5
|
gameSpeed = 0.5
|
||||||
|
|
||||||
|
var current_playback_position : float = 0.0
|
||||||
|
|
||||||
|
if current_audio_player:
|
||||||
|
current_playback_position = current_audio_player.get_playback_position()
|
||||||
|
current_audio_player.stop()
|
||||||
|
|
||||||
|
current_audio_player = audio_player_slow
|
||||||
|
current_audio_player.play(current_playback_position)
|
||||||
|
|
||||||
|
|
||||||
func register_change_action(change_action : Node) -> void:
|
func register_change_action(change_action : Node) -> void:
|
||||||
print("Registered change action")
|
print("Registered change action")
|
||||||
|
|
Loading…
Reference in New Issue