diff --git a/audio/sounds/coin.wav b/audio/sounds/coin.wav new file mode 100644 index 0000000..c258b39 Binary files /dev/null and b/audio/sounds/coin.wav differ diff --git a/audio/sounds/coin.wav.import b/audio/sounds/coin.wav.import new file mode 100644 index 0000000..24f1394 --- /dev/null +++ b/audio/sounds/coin.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/coin.wav-684b22528021c5adcd535ba4ddcbd887.sample" + +[deps] + +source_file="res://audio/sounds/coin.wav" +dest_files=[ "res://.import/coin.wav-684b22528021c5adcd535ba4ddcbd887.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/audio/sounds/stab.wav b/audio/sounds/stab.wav new file mode 100644 index 0000000..665e7e2 Binary files /dev/null and b/audio/sounds/stab.wav differ diff --git a/audio/sounds/stab.wav.import b/audio/sounds/stab.wav.import new file mode 100644 index 0000000..c019167 --- /dev/null +++ b/audio/sounds/stab.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/stab.wav-c201d15cc0a56178959694372eb53d41.sample" + +[deps] + +source_file="res://audio/sounds/stab.wav" +dest_files=[ "res://.import/stab.wav-c201d15cc0a56178959694372eb53d41.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/autoloads/audio.gd b/autoloads/audio.gd index 285de20..3cd26e7 100644 --- a/autoloads/audio.gd +++ b/autoloads/audio.gd @@ -76,6 +76,8 @@ const a_mech_hurt_2 = preload("res://audio/sounds/mech_hurt_2.ogg") const a_mech_hurt_3 = preload("res://audio/sounds/mech_hurt_3.ogg") const a_critical_heat = preload("res://audio/sounds/critical_heat.ogg") const a_glass_break = preload("res://audio/sounds/cop_shoot.ogg") +const a_shield = preload("res://audio/sounds/stab.wav") +const a_shield_cooldown = preload("res://audio/sounds/coin.wav") var loop_section = null var has_looped = false diff --git a/autoloads/debug.gd b/autoloads/debug.gd index 079a35c..e6d493c 100644 --- a/autoloads/debug.gd +++ b/autoloads/debug.gd @@ -234,3 +234,6 @@ func _enter_code(): Game.change_map(load("res://menus/credits.tscn")) "SLOWPOKE": Game.time = 99999 + "LASERTAG": + Game.can_use_shield = true + is_cheating = true diff --git a/autoloads/game.gd b/autoloads/game.gd index 3c07606..6c6ee40 100644 --- a/autoloads/game.gd +++ b/autoloads/game.gd @@ -51,6 +51,7 @@ var current_palette: String = "default" var still_playing: bool = false var last_mm_button = null var alternate_death = null +var can_use_shield: bool = false #== marathon mode ==# var marathon_mode: bool = false var marathon_score: int = 0 diff --git a/objects/player/player.gd b/objects/player/player.gd index 7c6c2ad..06e3688 100644 --- a/objects/player/player.gd +++ b/objects/player/player.gd @@ -47,6 +47,8 @@ var skip_blood: bool = false #whether sg has landed before var first_land = true +var can_shield = true + # NODE REFERENCES # onready var state_chart: StateChart = $StateChart @@ -116,6 +118,17 @@ func _physics_process(delta: float) -> void: state_chart.send_event("duck_pressed") if Input.is_action_just_released("move_down"): state_chart.send_event("duck_released") + if Input.is_action_just_pressed("shield") && Game.can_use_shield == true: + if can_shield: + Audio.play_sound(Audio.a_shield,Audio.ac_die) + $ShieldTimer.start() + $ShieldCooldown.start() + $Shield.visible = true + $"%AirborneShape".disabled = true + $"%GroundedShape".disabled = true + can_shield = false + + # send relevant events if is_on_floor(): # check on floor status @@ -571,3 +584,14 @@ func make_blood(): func _on_Zapping_state_exited(): $Graphics/ZapSprite.visible = false emit_signal("died") + + +func _on_ShieldTimer_timeout(): + $Shield.visible = false + $"%AirborneShape".disabled = false + $"%GroundedShape".disabled = false + + +func _on_ShieldCooldown_timeout(): + can_shield = true + Audio.play_sound(Audio.a_shield_cooldown,Audio.ac_boss) diff --git a/objects/player/player.tscn b/objects/player/player.tscn index b51552d..5e7e3fe 100644 --- a/objects/player/player.tscn +++ b/objects/player/player.tscn @@ -1515,13 +1515,27 @@ margin_bottom = -18.0 theme = ExtResource( 7 ) align = 1 +[node name="ShieldTimer" type="Timer" parent="."] +wait_time = 0.5 + +[node name="Shield" type="Polygon2D" parent="."] +visible = false +position = Vector2( 1, -1 ) +scale = Vector2( 1.06667, 0.727273 ) +color = Color( 0.0352941, 0.796078, 0.854902, 0.470588 ) +polygon = PoolVector2Array( 0, -29, -8, -14.3333, -1, 4, 7, -14 ) + +[node name="ShieldCooldown" type="Timer" parent="."] +wait_time = 2.0 +one_shot = true + [connection signal="tree_exited" from="." to="." method="_on_Player_tree_exited"] [connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"] [connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded" to="." method="_process_grounded"] -[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement_grounded"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_can_walk"] +[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement_grounded"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Still" to="." method="_on_Still_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Walking" to="." method="_on_Walking_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Blinking" to="." method="_on_Blinking_state_entered"] @@ -1535,8 +1549,8 @@ align = 1 [connection signal="state_entered" from="StateChart/Root/Movement/Airborne" to="." method="_on_Airborne_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Airborne" to="." method="reset_fall_speed"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne" to="." method="_process_gravity"] -[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_horizontal_movement"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_jump"] +[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_horizontal_movement"] [connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_entered"] [connection signal="state_exited" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_exited"] [connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/LadderJump" to="." method="_on_LadderJump_state_entered"] @@ -1569,3 +1583,5 @@ align = 1 [connection signal="state_entered" from="StateChart/Root/Health/Zapping" to="." method="_on_Zapping_state_entered"] [connection signal="state_exited" from="StateChart/Root/Health/Zapping" to="." method="_on_Zapping_state_exited"] [connection signal="timeout" from="OxygenTimer" to="." method="_on_OxygenTimer_timeout"] +[connection signal="timeout" from="ShieldTimer" to="." method="_on_ShieldTimer_timeout"] +[connection signal="timeout" from="ShieldCooldown" to="." method="_on_ShieldCooldown_timeout"] diff --git a/project.godot b/project.godot index 711f1ec..c7a8f27 100644 --- a/project.godot +++ b/project.godot @@ -354,6 +354,12 @@ ui_start={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null) ] } +shield={ +"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":67,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":5,"pressure":0.0,"pressed":false,"script":null) + ] +} [input_devices]