GET BZAPPED

This commit is contained in:
Haze Weathers 2024-07-08 16:36:30 -04:00
parent c97f41fb47
commit 45ffc4d3b7
5 changed files with 303 additions and 6 deletions

BIN
graphics/player/sg_zap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/sg_zap.png-42b9645cdd95a12a23b467e9a2265eec.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/player/sg_zap.png"
dest_files=[ "res://.import/sg_zap.png-42b9645cdd95a12a23b467e9a2265eec.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -3,5 +3,4 @@ extends Area2D
func _on_Area2D_area_entered(area): func _on_Area2D_area_entered(area):
#Kill player #Kill player
if area.is_in_group("player_hitbox"): if area.is_in_group("player_hitbox"):
Game.alternate_death = Audio.a_die_zap area.get_parent().zap()
area.get_parent().die()

View file

@ -151,6 +151,9 @@ func spawn_arrow() -> void:
func die() -> void: func die() -> void:
state_chart.send_event("hurt") state_chart.send_event("hurt")
func zap() -> void:
state_chart.send_event("zapped")
func set_underwater_audio(value): func set_underwater_audio(value):
var idx = AudioServer.get_bus_index("Master") var idx = AudioServer.get_bus_index("Master")
AudioServer.set_bus_effect_enabled(idx,0,value) AudioServer.set_bus_effect_enabled(idx,0,value)
@ -540,3 +543,29 @@ func _on_OxygenTimer_timeout():
#Reset low oxygen effect when leaving level #Reset low oxygen effect when leaving level
func _on_Player_tree_exited(): func _on_Player_tree_exited():
set_underwater_audio(false) set_underwater_audio(false)
func _on_Zapping_state_entered():
velocity = Vector2.ZERO
Audio.play_sound(Audio.a_die_zap, Audio.ac_die)
animation_player.call_deferred("play", "zap")
func make_blood():
var particles = DeathSplatter.instance()
particles.global_position = death_splatter_position.global_position
particles.emitting = true
get_parent().add_child(particles)
for i in 16:
var spray = BloodSpray.instance()
spray.pause_mode = PAUSE_MODE_PROCESS
Physics2DServer.set_active(true)
spray.global_position = death_splatter_position.global_position
spray.velocity = Vector2(randf() * 80.0, 0.0).rotated(randf() * TAU)
spray.stains_player = false
get_parent().add_child(spray)
func _on_Zapping_state_exited():
$Graphics/ZapSprite.visible = false
emit_signal("died")

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=42 format=2] [gd_scene load_steps=49 format=2]
[ext_resource path="res://objects/player/player.gd" type="Script" id=1] [ext_resource path="res://objects/player/player.gd" type="Script" id=1]
[ext_resource path="res://graphics/player/sg_zap.png" type="Texture" id=2]
[ext_resource path="res://shaders/recolor_border.shader" type="Shader" id=3] [ext_resource path="res://shaders/recolor_border.shader" type="Shader" id=3]
[ext_resource path="res://graphics/player/sg_idle.png" type="Texture" id=4] [ext_resource path="res://graphics/player/sg_idle.png" type="Texture" id=4]
[ext_resource path="res://addons/godot_state_charts/parallel_state.gd" type="Script" id=5] [ext_resource path="res://addons/godot_state_charts/parallel_state.gd" type="Script" id=5]
@ -11,6 +12,7 @@
[ext_resource path="res://addons/godot_state_charts/transition.gd" type="Script" id=10] [ext_resource path="res://addons/godot_state_charts/transition.gd" type="Script" id=10]
[ext_resource path="res://addons/godot_state_charts/atomic_state.gd" type="Script" id=11] [ext_resource path="res://addons/godot_state_charts/atomic_state.gd" type="Script" id=11]
[ext_resource path="res://graphics/player/palettes/default.tex" type="Texture" id=12] [ext_resource path="res://graphics/player/palettes/default.tex" type="Texture" id=12]
[ext_resource path="res://shaders/electricity.gdshader" type="Shader" id=13]
[ext_resource path="res://graphics/player/sg.png" type="Texture" id=14] [ext_resource path="res://graphics/player/sg.png" type="Texture" id=14]
[ext_resource path="res://graphics/particles/dust.png" type="Texture" id=18] [ext_resource path="res://graphics/particles/dust.png" type="Texture" id=18]
[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=25] [ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=25]
@ -21,6 +23,34 @@ shader_param/border_color = Color( 0, 0, 0, 1 )
shader_param/border_corners = true shader_param/border_corners = true
shader_param/palette = ExtResource( 12 ) shader_param/palette = ExtResource( 12 )
[sub_resource type="ShaderMaterial" id=32]
shader = ExtResource( 13 )
shader_param/arc_speed = 4.0
shader_param/arc_fps = 10.0
shader_param/arc_scale = 8.0
shader_param/arc_threshold = 0.15
shader_param/arc_color = Color( 1, 0.93, 0, 1 )
shader_param/gamma = 2.0
shader_param/flash_rate = 3.0
shader_param/flash_intensity = 0.2
shader_param/background_color = Color( 0, 0, 0, 0 )
[sub_resource type="AtlasTexture" id=28]
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 20, 20 )
[sub_resource type="AtlasTexture" id=29]
atlas = ExtResource( 2 )
region = Rect2( 20, 0, 20, 20 )
[sub_resource type="SpriteFrames" id=30]
animations = [ {
"frames": [ SubResource( 28 ), SubResource( 29 ) ],
"loop": true,
"name": "zap",
"speed": 15.0
} ]
[sub_resource type="Shader" id=26] [sub_resource type="Shader" id=26]
code = "// Recolor code = "// Recolor
shader_type canvas_item; shader_type canvas_item;
@ -117,6 +147,54 @@ tracks/4/keys = {
"update": 1, "update": 1,
"values": [ 8 ] "values": [ 8 ]
} }
tracks/5/type = "value"
tracks/5/path = NodePath("Graphics/Sprite:visible")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ true ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("Graphics/ZapSprite:visible")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ false ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("Graphics/ZapSprite:frame")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0 ]
}
tracks/8/type = "value"
tracks/8/path = NodePath("Graphics/ZapSprite:playing")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ false ]
}
[sub_resource type="Animation" id=18] [sub_resource type="Animation" id=18]
resource_name = "blink" resource_name = "blink"
@ -146,8 +224,7 @@ tracks/1/keys = {
"values": [ 96, 97, 96 ] "values": [ 96, 97, 96 ]
} }
[sub_resource type="Animation" id=9] [sub_resource type="Animation" id=31]
resource_name = "climb"
length = 0.3 length = 0.3
loop = true loop = true
step = 0.15 step = 0.15
@ -516,6 +593,54 @@ tracks/1/keys = {
"update": 0, "update": 0,
"values": [ 0.0 ] "values": [ 0.0 ]
} }
tracks/2/type = "value"
tracks/2/path = NodePath("Graphics/Sprite:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Graphics/ZapSprite:playing")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Graphics/ZapSprite:frame")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 0 ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Graphics/ZapSprite:visible")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=11] [sub_resource type="Animation" id=11]
resource_name = "shoot_airborne" resource_name = "shoot_airborne"
@ -661,6 +786,86 @@ tracks/1/keys = {
"values": [ 0.0 ] "values": [ 0.0 ]
} }
[sub_resource type="Animation" id=33]
resource_name = "zap"
length = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("Graphics/Sprite:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Graphics/ZapSprite:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Graphics/ZapSprite:frame")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 0 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Graphics/ZapSprite:playing")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
tracks/4/type = "method"
tracks/4/path = NodePath("StateChart")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0.5 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ "respawn" ],
"method": "send_event"
} ]
}
tracks/5/type = "method"
tracks/5/path = NodePath(".")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0.5 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "make_blood"
} ]
}
[sub_resource type="StyleBoxEmpty" id=4] [sub_resource type="StyleBoxEmpty" id=4]
[node name="Player" type="KinematicBody2D" groups=["player"]] [node name="Player" type="KinematicBody2D" groups=["player"]]
@ -685,6 +890,13 @@ offset = Vector2( 0, -6 )
hframes = 8 hframes = 8
vframes = 20 vframes = 20
[node name="ZapSprite" type="AnimatedSprite" parent="Graphics"]
visible = false
material = SubResource( 32 )
position = Vector2( 0, -10 )
frames = SubResource( 30 )
animation = "zap"
[node name="DissolveParticles" type="CPUParticles2D" parent="Graphics"] [node name="DissolveParticles" type="CPUParticles2D" parent="Graphics"]
unique_name_in_owner = true unique_name_in_owner = true
material = SubResource( 27 ) material = SubResource( 27 )
@ -795,7 +1007,7 @@ collide_with_bodies = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/RESET = SubResource( 5 ) anims/RESET = SubResource( 5 )
anims/blink = SubResource( 18 ) anims/blink = SubResource( 18 )
anims/climb = SubResource( 9 ) anims/climb = SubResource( 31 )
anims/double_jump = SubResource( 12 ) anims/double_jump = SubResource( 12 )
anims/drown = SubResource( 23 ) anims/drown = SubResource( 23 )
anims/duck = SubResource( 20 ) anims/duck = SubResource( 20 )
@ -811,6 +1023,7 @@ anims/shoot_airborne = SubResource( 11 )
anims/shoot_grounded = SubResource( 10 ) anims/shoot_grounded = SubResource( 10 )
anims/stim = SubResource( 19 ) anims/stim = SubResource( 19 )
anims/walk = SubResource( 7 ) anims/walk = SubResource( 7 )
anims/zap = SubResource( 33 )
[node name="StateChart" type="Node" parent="."] [node name="StateChart" type="Node" parent="."]
script = ExtResource( 6 ) script = ExtResource( 6 )
@ -835,6 +1048,11 @@ script = ExtResource( 10 )
to = NodePath("../Inactive") to = NodePath("../Inactive")
event = "drown" event = "drown"
[node name="On Zapped" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource( 10 )
to = NodePath("../Inactive")
event = "zapped"
[node name="On Died" type="Node" parent="StateChart/Root/Movement"] [node name="On Died" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource( 10 ) script = ExtResource( 10 )
to = NodePath("../Appearing") to = NodePath("../Appearing")
@ -1180,6 +1398,11 @@ script = ExtResource( 10 )
to = NodePath("../../Invulnerable") to = NodePath("../../Invulnerable")
event = "become_invulnerable" event = "become_invulnerable"
[node name="On Zapped" type="Node" parent="StateChart/Root/Health/Vulnerable"]
script = ExtResource( 10 )
to = NodePath("../../Zapping")
event = "zapped"
[node name="Invulnerable" type="Node" parent="StateChart/Root/Health"] [node name="Invulnerable" type="Node" parent="StateChart/Root/Health"]
script = ExtResource( 11 ) script = ExtResource( 11 )
@ -1227,6 +1450,15 @@ event = "float_up"
[node name="FloatingUp" type="Node" parent="StateChart/Root/Health/Drowning"] [node name="FloatingUp" type="Node" parent="StateChart/Root/Health/Drowning"]
script = ExtResource( 11 ) script = ExtResource( 11 )
[node name="Zapping" type="Node" parent="StateChart/Root/Health"]
script = ExtResource( 11 )
[node name="On Respawn" type="Node" parent="StateChart/Root/Health/Zapping"]
script = ExtResource( 10 )
to = NodePath("../../Respawn")
event = "respawn"
guard_expression = "can_respawn"
[node name="StateDebugLayer" type="CanvasLayer" parent="."] [node name="StateDebugLayer" type="CanvasLayer" parent="."]
layer = 128 layer = 128
@ -1310,4 +1542,6 @@ align = 1
[connection signal="state_entered" from="StateChart/Root/Health/Drowning" to="." method="_on_Drowning_state_entered"] [connection signal="state_entered" from="StateChart/Root/Health/Drowning" to="." method="_on_Drowning_state_entered"]
[connection signal="state_exited" from="StateChart/Root/Health/Drowning" to="." method="_on_Drowning_state_exited"] [connection signal="state_exited" from="StateChart/Root/Health/Drowning" to="." method="_on_Drowning_state_exited"]
[connection signal="state_physics_processing" from="StateChart/Root/Health/Drowning/FloatingUp" to="." method="_process_floating_up"] [connection signal="state_physics_processing" from="StateChart/Root/Health/Drowning/FloatingUp" to="." method="_process_floating_up"]
[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="OxygenTimer" to="." method="_on_OxygenTimer_timeout"]