diff --git a/Main.sync-conflict-20250330-220824-MOVV2HN.tscn b/Main.sync-conflict-20250330-220824-MOVV2HN.tscn new file mode 100644 index 0000000..cd5f3d1 --- /dev/null +++ b/Main.sync-conflict-20250330-220824-MOVV2HN.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://src/actors/players/playerE/PlayerE.tscn" type="PackedScene" id=1] +[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/ui/HUD.tscn" type="PackedScene" id=3] + +[node name="Main" type="Node2D"] + +[node name="TestBox" parent="." instance=ExtResource( 2 )] +__meta__ = { +"_edit_lock_": true +} + +[node name="PlayerE" parent="." instance=ExtResource( 1 )] +position = Vector2( 112, 56 ) + +[node name="UI_Layer" parent="." instance=ExtResource( 3 )] diff --git a/Main.tscn b/Main.tscn index 6a7132d..dacc417 100644 --- a/Main.tscn +++ b/Main.tscn @@ -18,3 +18,5 @@ __meta__ = { position = Vector2( 112, 56 ) [node name="UI_Layer" parent="." instance=ExtResource( 3 )] + +[node name="MusicPlayer" type="AudioStreamPlayer" parent="."] diff --git a/assets_tmp/Music/summer nights.ogg b/assets_tmp/Music/summer nights.ogg new file mode 100644 index 0000000..a19d282 Binary files /dev/null and b/assets_tmp/Music/summer nights.ogg differ diff --git a/assets_tmp/Music/summer nights.ogg.import b/assets_tmp/Music/summer nights.ogg.import new file mode 100644 index 0000000..926f4b7 --- /dev/null +++ b/assets_tmp/Music/summer nights.ogg.import @@ -0,0 +1,15 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/summer nights.ogg-5ab1bf5ee50e01e8c790382e18d8d7ae.oggstr" + +[deps] + +source_file="res://assets_tmp/Music/summer nights.ogg" +dest_files=[ "res://.import/summer nights.ogg-5ab1bf5ee50e01e8c790382e18d8d7ae.oggstr" ] + +[params] + +loop=true +loop_offset=0 diff --git a/assets_tmp/SE/door_a.wav b/assets_tmp/SE/door_a.wav new file mode 100644 index 0000000..fee4440 Binary files /dev/null and b/assets_tmp/SE/door_a.wav differ diff --git a/assets_tmp/SE/door_a.wav.import b/assets_tmp/SE/door_a.wav.import new file mode 100644 index 0000000..b7163ef --- /dev/null +++ b/assets_tmp/SE/door_a.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/door_a.wav-af28d3164b6ea77805c19713d04436f1.sample" + +[deps] + +source_file="res://assets_tmp/SE/door_a.wav" +dest_files=[ "res://.import/door_a.wav-af28d3164b6ea77805c19713d04436f1.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets_tmp/SE/hit_a.wav b/assets_tmp/SE/hit_a.wav new file mode 100644 index 0000000..1614c1a Binary files /dev/null and b/assets_tmp/SE/hit_a.wav differ diff --git a/assets_tmp/SE/hit_a.wav.import b/assets_tmp/SE/hit_a.wav.import new file mode 100644 index 0000000..433884e --- /dev/null +++ b/assets_tmp/SE/hit_a.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/hit_a.wav-54645552806f5ce18a4e26344d3be4b8.sample" + +[deps] + +source_file="res://assets_tmp/SE/hit_a.wav" +dest_files=[ "res://.import/hit_a.wav-54645552806f5ce18a4e26344d3be4b8.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets_tmp/SE/land.wav b/assets_tmp/SE/land.wav new file mode 100644 index 0000000..dd267bc Binary files /dev/null and b/assets_tmp/SE/land.wav differ diff --git a/assets_tmp/SE/land.wav.import b/assets_tmp/SE/land.wav.import new file mode 100644 index 0000000..3ffa2ed --- /dev/null +++ b/assets_tmp/SE/land.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/land.wav-387003e3c9887380132c51d2d20620cc.sample" + +[deps] + +source_file="res://assets_tmp/SE/land.wav" +dest_files=[ "res://.import/land.wav-387003e3c9887380132c51d2d20620cc.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets_tmp/SE/pop.wav b/assets_tmp/SE/pop.wav new file mode 100644 index 0000000..a50cdc3 Binary files /dev/null and b/assets_tmp/SE/pop.wav differ diff --git a/assets_tmp/SE/pop.wav.import b/assets_tmp/SE/pop.wav.import new file mode 100644 index 0000000..333fa29 --- /dev/null +++ b/assets_tmp/SE/pop.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/pop.wav-233ae352faded754a591c4a44a5f258a.sample" + +[deps] + +source_file="res://assets_tmp/SE/pop.wav" +dest_files=[ "res://.import/pop.wav-233ae352faded754a591c4a44a5f258a.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets_tmp/SE/shot_a.wav b/assets_tmp/SE/shot_a.wav new file mode 100644 index 0000000..e3f68be Binary files /dev/null and b/assets_tmp/SE/shot_a.wav differ diff --git a/assets_tmp/SE/shot_a.wav.import b/assets_tmp/SE/shot_a.wav.import new file mode 100644 index 0000000..a16ac23 --- /dev/null +++ b/assets_tmp/SE/shot_a.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/shot_a.wav-469c6d42db3f1549bc725112dbad0c8b.sample" + +[deps] + +source_file="res://assets_tmp/SE/shot_a.wav" +dest_files=[ "res://.import/shot_a.wav-469c6d42db3f1549bc725112dbad0c8b.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets_tmp/SE/tap.wav b/assets_tmp/SE/tap.wav new file mode 100644 index 0000000..de9e694 Binary files /dev/null and b/assets_tmp/SE/tap.wav differ diff --git a/assets_tmp/SE/tap.wav.import b/assets_tmp/SE/tap.wav.import new file mode 100644 index 0000000..cba99ce --- /dev/null +++ b/assets_tmp/SE/tap.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/tap.wav-0b54164b5e92fd14172eaf1f67101351.sample" + +[deps] + +source_file="res://assets_tmp/SE/tap.wav" +dest_files=[ "res://.import/tap.wav-0b54164b5e92fd14172eaf1f67101351.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets_tmp/SE/tick.wav b/assets_tmp/SE/tick.wav new file mode 100644 index 0000000..2b2f05e Binary files /dev/null and b/assets_tmp/SE/tick.wav differ diff --git a/assets_tmp/SE/tick.wav.import b/assets_tmp/SE/tick.wav.import new file mode 100644 index 0000000..7562bbb --- /dev/null +++ b/assets_tmp/SE/tick.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/tick.wav-288f2e396cfd3edb94d732bdcee848e3.sample" + +[deps] + +source_file="res://assets_tmp/SE/tick.wav" +dest_files=[ "res://.import/tick.wav-288f2e396cfd3edb94d732bdcee848e3.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets_tmp/SE/tick2.wav b/assets_tmp/SE/tick2.wav new file mode 100644 index 0000000..0fb30b2 Binary files /dev/null and b/assets_tmp/SE/tick2.wav differ diff --git a/assets_tmp/SE/tick2.wav.import b/assets_tmp/SE/tick2.wav.import new file mode 100644 index 0000000..4ed1351 --- /dev/null +++ b/assets_tmp/SE/tick2.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/tick2.wav-725cdabf8b024aed7e5833aa4f009df7.sample" + +[deps] + +source_file="res://assets_tmp/SE/tick2.wav" +dest_files=[ "res://.import/tick2.wav-725cdabf8b024aed7e5833aa4f009df7.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets_tmp/SE/tink.wav b/assets_tmp/SE/tink.wav new file mode 100644 index 0000000..51f2031 Binary files /dev/null and b/assets_tmp/SE/tink.wav differ diff --git a/assets_tmp/SE/tink.wav.import b/assets_tmp/SE/tink.wav.import new file mode 100644 index 0000000..c20daf6 --- /dev/null +++ b/assets_tmp/SE/tink.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/tink.wav-edd569613ac2bf93a8f5fef1375d2203.sample" + +[deps] + +source_file="res://assets_tmp/SE/tink.wav" +dest_files=[ "res://.import/tink.wav-edd569613ac2bf93a8f5fef1375d2203.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets_tmp/SE/whiff.wav b/assets_tmp/SE/whiff.wav new file mode 100644 index 0000000..4e1f1a2 Binary files /dev/null and b/assets_tmp/SE/whiff.wav differ diff --git a/assets_tmp/SE/whiff.wav.import b/assets_tmp/SE/whiff.wav.import new file mode 100644 index 0000000..e02ff17 --- /dev/null +++ b/assets_tmp/SE/whiff.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/whiff.wav-14d346818caf5200cee06d66813e1406.sample" + +[deps] + +source_file="res://assets_tmp/SE/whiff.wav" +dest_files=[ "res://.import/whiff.wav-14d346818caf5200cee06d66813e1406.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/lib/classes/actor.gd b/lib/classes/actor.gd index 9e6cca7..e3bd2db 100644 --- a/lib/classes/actor.gd +++ b/lib/classes/actor.gd @@ -11,7 +11,7 @@ export var debug_actor: bool = false #onready var movement_animations: AnimatedSprite = $AnimatedSprite -onready var sound_effect_player: AudioStreamPlayer = $SE_Player +onready var sound_effect_player: AudioStreamPlayer = $AudioStreamPlayer_StateReceiver #onready var movement_component: MovementComponent = $movement_component onready var movement_component: Movement_StateReceiver = $Movement_StateReceiver diff --git a/lib/classes/audiostreamplayer_state_receiver.gd b/lib/classes/audiostreamplayer_state_receiver.gd index d6f068a..a017ad0 100644 --- a/lib/classes/audiostreamplayer_state_receiver.gd +++ b/lib/classes/audiostreamplayer_state_receiver.gd @@ -7,7 +7,7 @@ var request_state_change: FuncRef export(Array, Resource) var sound_effects -onready var current_state = StateAnimatedActor.new() +onready var current_state :StateAnimatedActor # Declare member variables here. Examples: # var a = 2 @@ -28,8 +28,10 @@ var sound_effects_dict: Dictionary func _ready(): # Trying something new with a custom resourse. for i in sound_effects: - sound_effects_dict[i.animation_name + str(i.frame_number)] = i.sound - print (sound_effects_dict) + if i is SE_StateFrame: + sound_effects_dict[i.state_name + str(i.frame_number)] = i + if debug_component: + print (sound_effects_dict) request_state_change = funcref(get_node(callable_state_machine), 'change_to_known_state') ## Connect signal to get alerted of state change @@ -43,22 +45,45 @@ func _ready(): #print(sounds.sounds["pew"]) #sound_effects.play() -var last_sound_frame_animation: String = '' -var last_sound_frame: int = -1 -func play_sound_frame(animation: String, frame: int ): - ##DEBUG: - #if animation == 'run' and frame == 6: - # print("Do the thign! (", animation + str(frame), ")", " (", last_sound_frame_animation + str(last_sound_frame), ")") - if animation != last_sound_frame_animation or frame != last_sound_frame: - last_sound_frame = frame - last_sound_frame_animation = animation - var sound_index = animation + str(frame) - if sound_effects_dict.has(sound_index): - stream = sound_effects_dict[sound_index] - play() - print(self.name, " Playing SE: ", sound_index) +#var last_sound_frame_animation: String = '' +#var last_sound_frame: int = -1 +#func play_sound_frame(animation: String, frame: int ): +# ##DEBUG: +# #if animation == 'run' and frame == 6: +# # print("Do the thign! (", animation + str(frame), ")", " (", last_sound_frame_animation + str(last_sound_frame), ")") +# if animation != last_sound_frame_animation or frame != last_sound_frame: +# last_sound_frame = frame +# last_sound_frame_animation = animation +# var sound_index = animation + str(frame) +# if sound_effects_dict.has(sound_index): +# stream = sound_effects_dict[sound_index] +# play() +# print(self.name, " Playing SE: ", sound_index) +var current_se_index :String # Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass +func _process(delta): + var sound_index = current_state.name + str(current_state.animation_frame) + if current_se_index != sound_index and sound_effects_dict.has(sound_index): + print("Play sound: ", current_state.name, current_state.animation_frame) + current_se_index = sound_index + ##TODO: Better to do an is check here or a cast + ## We already assure these are SE_StateFrames + var se_resource :SE_StateFrame = sound_effects_dict[sound_index] + stream = se_resource.sound + #var this_sound :AudioStreamSample + play() + # Not sure what should be called first here. + if has_method('_state_process_' + current_state.name): + call('_state_process_' + current_state.name) + +func _on_state_change(old_state_name:String, new_state :State): + ###### State machine + if new_state is StateAnimatedActor: #Testing this. Update: It works + current_state = new_state + if has_method('_on_state_change_' + current_state.name): + call('_on_state_change_' + current_state.name) + else: + push_warning("Received non animated Actor state.") + #current_state = new_state diff --git a/lib/classes/sound_effect_state_frame.gd b/lib/classes/sound_effect_state_frame.gd index abe7924..01766d2 100644 --- a/lib/classes/sound_effect_state_frame.gd +++ b/lib/classes/sound_effect_state_frame.gd @@ -3,5 +3,9 @@ extends Resource export (String) var state_name -export(int) var frame_number +export(int) var frame_number = 0 + +## Editor will enumerate +enum TYPE {FRAME_ONE_SHOT, LOOPING, NONE = -1} +export(TYPE) var sound_effect_type = TYPE.FRAME_ONE_SHOT export (AudioStreamSample) var sound diff --git a/lib/singleton_autoloads/LevelInfo.gd b/lib/singleton_autoloads/LevelInfo.gd index f15e091..7944865 100644 --- a/lib/singleton_autoloads/LevelInfo.gd +++ b/lib/singleton_autoloads/LevelInfo.gd @@ -7,6 +7,26 @@ extends Node ##TODO: Should be based on screen position for starter onready var player_start_position := Vector2(50,50) +onready var current_music_track :AudioStream + +func change_music_track(_music_track :AudioStream ): + if current_music_track != _music_track: + current_music_track = _music_track + var juke_box: AudioStreamPlayer = get_node("/root/Main/MusicPlayer") + if juke_box: + if juke_box.playing: + juke_box.stop() + juke_box.stream = current_music_track + juke_box.play() + else: + push_warning("Music Player '/root/Main/MusicPlayer' not found.") + +func stop_music(): + var juke_box: AudioStreamPlayer = get_node("/root/Main/MusicPlayer") + if juke_box: + if juke_box.playing: + juke_box.stop() + func change_level(_level_name :String, _position_name :String): print("res://src/levels/" + _level_name + ".tscn" ) var SceneTransition = get_node("/root/Main/SceneTransition") diff --git a/lib/templates/Actor/ActorTemplate.tscn b/lib/templates/Actor/ActorTemplate.tscn index a06e9ee..2a6279b 100644 --- a/lib/templates/Actor/ActorTemplate.tscn +++ b/lib/templates/Actor/ActorTemplate.tscn @@ -37,4 +37,3 @@ callable_state_machine = NodePath("../Movement_StateMachine") [node name="AudioStreamPlayer_StateReceiver" type="AudioStreamPlayer" parent="."] script = ExtResource( 3 ) callable_state_machine = NodePath("../Movement_StateMachine") -sound_effects = [ null ] diff --git a/project.sync-conflict-20250330-220824-MOVV2HN.godot b/project.sync-conflict-20250330-220824-MOVV2HN.godot new file mode 100644 index 0000000..ac65692 --- /dev/null +++ b/project.sync-conflict-20250330-220824-MOVV2HN.godot @@ -0,0 +1,292 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +_global_script_classes=[ { +"base": "KinematicBody2D", +"class": "Actor", +"language": "GDScript", +"path": "res://lib/classes/actor.gd" +}, { +"base": "AnimatedSprite", +"class": "AnimatedSprite_StateReceiver", +"language": "GDScript", +"path": "res://lib/classes/animated_sprite_state_receiver.gd" +}, { +"base": "Reference", +"class": "DEPR_ModifierProperties", +"language": "GDScript", +"path": "res://lib/classes/DEPR_state_modifier_properties.gd" +}, { +"base": "Reference", +"class": "DumbOldStateModifier", +"language": "GDScript", +"path": "res://lib/classes/DEPR_state_modifier.gd" +}, { +"base": "", +"class": "GitAPI", +"language": "NativeScript", +"path": "res://addons/godot-git-plugin/git_api.gdns" +}, { +"base": "Node", +"class": "HealthComponent", +"language": "GDScript", +"path": "res://lib/components/Health_Component.gd" +}, { +"base": "Interactable", +"class": "HealthPickup", +"language": "GDScript", +"path": "res://src/Interactables/HealthPickup.gd" +}, { +"base": "Area2D", +"class": "Interactable", +"language": "GDScript", +"path": "res://lib/templates/Interactable/Interactable_Component.gd" +}, { +"base": "Node2D", +"class": "Interactable_Receiver", +"language": "GDScript", +"path": "res://lib/templates/Interactable/Interactable_Receiver.gd" +}, { +"base": "Node2D", +"class": "Level", +"language": "GDScript", +"path": "res://src/classes/Level.gd" +}, { +"base": "Node2D", +"class": "Modifier_Receiver", +"language": "GDScript", +"path": "res://lib/components/Modifier_Receiver.gd" +}, { +"base": "Node", +"class": "MovementComponent", +"language": "GDScript", +"path": "res://src/classes/movement_component.gd" +}, { +"base": "Node", +"class": "Movement_StateReceiver", +"language": "GDScript", +"path": "res://lib/classes/movement_state_receiver.gd" +}, { +"base": "Resource", +"class": "State", +"language": "GDScript", +"path": "res://lib/classes/state.gd" +}, { +"base": "State", +"class": "StateAnimatedActor", +"language": "GDScript", +"path": "res://lib/classes/state_animated_actor.gd" +}, { +"base": "Node", +"class": "StateMachine", +"language": "GDScript", +"path": "res://lib/classes/state_machine.gd" +}, { +"base": "StateMachine", +"class": "StateMachineAnimatedActor", +"language": "GDScript", +"path": "res://lib/classes/state_machine_animated_actor.gd" +}, { +"base": "Reference", +"class": "StateModifier", +"language": "GDScript", +"path": "res://lib/classes/state_modifier.gd" +}, { +"base": "StateModifier", +"class": "StateModifierAnimatedActor", +"language": "GDScript", +"path": "res://lib/classes/state_modifier_animation.gd" +}, { +"base": "CanvasLayer", +"class": "UIComponent", +"language": "GDScript", +"path": "res://src/ui/HUD.gd" +} ] +_global_script_class_icons={ +"Actor": "", +"AnimatedSprite_StateReceiver": "", +"DEPR_ModifierProperties": "", +"DumbOldStateModifier": "", +"GitAPI": "", +"HealthComponent": "", +"HealthPickup": "", +"Interactable": "", +"Interactable_Receiver": "", +"Level": "", +"Modifier_Receiver": "", +"MovementComponent": "", +"Movement_StateReceiver": "", +"State": "", +"StateAnimatedActor": "", +"StateMachine": "", +"StateMachineAnimatedActor": "", +"StateModifier": "", +"StateModifierAnimatedActor": "", +"UIComponent": "" +} + +[application] + +config/name="Attempt 2" +run/main_scene="res://Main.tscn" +run/delta_sync_after_draw=true +run/delta_smoothing=false +boot_splash/show_image=false +config/icon="res://icon.png" + +[aseprite] + +animation/layers/exclusion_pattern="-.*" +animation/layers/only_include_visible_layers_by_default=true + +[autoload] + +PlayerInfo="*res://lib/singleton_autoloads/PlayerInfo.gd" +UiManager="*res://lib/singleton_autoloads/UIManager.gd" +LevelInfo="*res://lib/singleton_autoloads/LevelInfo.gd" + +[debug] + +shapes/collision/shape_color=Color( 1, 1, 1, 0.419608 ) + +[display] + +window/size/width=320 +window/size/height=180 +window/size/resizable=false +window/size/test_width=960 +window/size/test_height=540 +window/stretch/mode="viewport" +window/stretch/aspect="keep" + +[editor_plugins] + +enabled=PoolStringArray( "res://addons/AsepriteWizard/plugin.cfg" ) + +[gui] + +common/drop_mouse_on_gui_input_disabled=true + +[importer_defaults] + +texture={ +"compress/bptc_ldr": 0, +"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/invert_color": false, +"process/normal_map_invert_y": false, +"process/premult_alpha": false, +"size_limit": 0, +"stream": false, +"svg/scale": 1.0 +} + +[input] + +ui_accept={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null) + ] +} +move_left_1={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) + ] +} +move_right_1={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null) + ] +} +crouch_1={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +jump_1={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":32,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null) + ] +} +dash_1={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":78,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null) + ] +} +attack_1={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null) + ] +} +attack_secondary_1={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":44,"unicode":0,"echo":false,"script":null) + ] +} +move_left_2={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +move_right_2={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +jump_2={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":74,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +shoot_2={ +"deadzone": 0.5, +"events": [ ] +} + +[layer_names] + +2d_physics/layer_1="World" +2d_physics/layer_2="Player" +2d_physics/layer_3="Enemies" +2d_physics/layer_5="PlayerHurtbox" +2d_physics/layer_6="EnemyHurtbox" +2d_physics/layer_7="PlayerHitbox" +2d_physics/layer_8="EnemyHitbox" +2d_physics/layer_11="Climbable" +common/enable_pause_aware_picking=true +2d/default_gravity=600 + +[physics] + +2d/default_gravity=280 +common/physics_interpolation=true + +[rendering] + +quality/driver/driver_name="GLES2" +vram_compression/import_etc=true diff --git a/src/actors/players/playerE/PlayerE.tscn b/src/actors/players/playerE/PlayerE.tscn index 04c43c0..3421999 100644 --- a/src/actors/players/playerE/PlayerE.tscn +++ b/src/actors/players/playerE/PlayerE.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=27 format=2] +[gd_scene load_steps=33 format=2] [ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2] @@ -23,6 +23,9 @@ [ext_resource path="res://lib/templates/Interactable/Interactable_Receiver.gd" type="Script" id=21] [ext_resource path="res://src/actors/players/playerE/states/enter_right.tres" type="Resource" id=22] [ext_resource path="res://src/actors/players/playerE/states/climb.tres" type="Resource" id=23] +[ext_resource path="res://lib/classes/sound_effect_state_frame.gd" type="Script" id=24] +[ext_resource path="res://assets_tmp/SE/tap.wav" type="AudioStream" id=25] +[ext_resource path="res://assets_tmp/SE/land.wav" type="AudioStream" id=26] [sub_resource type="Resource" id=3] resource_local_to_scene = true @@ -38,6 +41,30 @@ horizontal_speed_offset_acceleration = 0.0 jerk_factor = 0.0 animation_sequence = [ "hurt" ] +[sub_resource type="Resource" id=4] +resource_name = "move_0" +script = ExtResource( 24 ) +state_name = "move" +frame_number = 0 +sound_effect_type = 0 +sound = ExtResource( 25 ) + +[sub_resource type="Resource" id=5] +resource_name = "move_4" +script = ExtResource( 24 ) +state_name = "move" +frame_number = 4 +sound_effect_type = 0 +sound = ExtResource( 25 ) + +[sub_resource type="Resource" id=6] +resource_name = "land_0" +script = ExtResource( 24 ) +state_name = "land" +frame_number = 0 +sound_effect_type = 0 +sound = ExtResource( 26 ) + [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 7, 14 ) @@ -94,6 +121,9 @@ collision_mask = 1024 collide_with_areas = true collide_with_bodies = false +[node name="AudioStreamPlayer_StateReceiver" parent="." index="6"] +sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ] + [node name="CollisionShape2D" type="CollisionShape2D" parent="." index="7"] position = Vector2( 0, 2 ) shape = SubResource( 1 ) diff --git a/src/classes/Level.gd b/src/classes/Level.gd index a039c23..f057a93 100644 --- a/src/classes/Level.gd +++ b/src/classes/Level.gd @@ -6,12 +6,21 @@ extends Node2D # var a = 2 # var b = "text" +export var music_track :AudioStream +## if no music_track specified, LevelInfo will keep +## the last running track playing +export var keep_last_music_track: bool = false + onready var player_start = $PlayerStart var entrances:Dictionary # Called when the node enters the scene tree for the first time. func _ready(): LevelInfo.player_start_position = player_start.transform.origin + if music_track: + LevelInfo.change_music_track(music_track) + elif keep_last_music_track == false: + LevelInfo.stop_music() for ent in get_children(): if ent is Position2D: diff --git a/src/levels/TestBox.tscn b/src/levels/TestBox.tscn index 2742139..c3e0a2a 100644 --- a/src/levels/TestBox.tscn +++ b/src/levels/TestBox.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2] [ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3] [ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4] +[ext_resource path="res://assets_tmp/Music/summer nights.ogg" type="AudioStream" id=5] [sub_resource type="CircleShape2D" id=1] radius = 5.09902 @@ -15,6 +16,7 @@ extents = Vector2( 4.5, 10 ) extents = Vector2( 8, 40 ) [node name="TestBox" instance=ExtResource( 1 )] +music_track = ExtResource( 5 ) [node name="TileMap Collision" parent="." index="1"] tile_set = ExtResource( 2 )