This commit is contained in:
pennyrigate 2024-08-13 20:33:46 -04:00
parent 1dc515904c
commit 2a1eda7cc0
10 changed files with 100 additions and 2 deletions

BIN
audio/sounds/coin.wav Normal file

Binary file not shown.

View file

@ -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

BIN
audio/sounds/stab.wav Normal file

Binary file not shown.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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"]

View file

@ -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]