feat, fix: made frog rideable🤠, no death animation when falliing into pit

This commit is contained in:
Jakob Feldmann 2023-09-18 15:05:49 +02:00
parent a8f21eac99
commit 80c69b5e2b
17 changed files with 580 additions and 368 deletions

View File

@ -19,7 +19,6 @@ onready var init_boost = player_state_machine.init_boost
onready var init_boost_type = player_state_machine.init_boost_type
var wall_touch_direction = 1
var stomping = false
var floor_angle = Vector2(0, 0)
var previous_rotation = 0
@ -460,8 +459,11 @@ func die(animation_number: int = 0) -> void:
signal_manager.emit_signal("player_died", animation_number)
$"%BlobbymationTree".active = false
$"%BlobbymationPlayer".play("dying3")
if animation_number < 1:
if animation_number == 0:
$"%BlobbymationPlayer".play("expandingDisolve")
if animation_number == -1:
respawn()
return
scene_audio.play_parallel_sound(death_sound_1, -15)
scene_audio.play_parallel_sound(death_sound_2, -16)
@ -483,6 +485,8 @@ func _on_BlobbySkin_area_entered(area: Area2D) -> void:
if area.is_in_group("harmful"):
die()
if area.is_in_group("pit"):
#scene_audio.play_parallel_sound(death_sound_1, -15)
scene_audio.play_parallel_sound(death_sound_2, -16)
$PitfallTimer.start()

View File

@ -4335,7 +4335,7 @@ tracks/2/keys = {
}
[node name="Blobby" type="KinematicBody2D" groups=["player"]]
collision_mask = 248
collision_mask = 250
collision/safe_margin = 0.001
script = ExtResource( 4 )
__meta__ = {
@ -4343,7 +4343,6 @@ __meta__ = {
}
[node name="StateLabel" type="Label" parent="."]
visible = false
show_behind_parent = true
margin_left = -37.0
margin_top = -44.0
@ -4385,7 +4384,7 @@ texture = SubResource( 62 )
offset = Vector2( 1, 0 )
hframes = 6
vframes = 6
frame = 10
frame = 8
__meta__ = {
"_editor_description_": "YXNlcHJpdGVfd2l6YXJkX2NvbmZpZwpwbGF5ZXJ8PUJsb2JieVNwcml0ZS9CbG9iYnltYXRpb25QbGF5ZXIKc291cmNlfD1yZXM6Ly9hc3NldHMvYmxvYmJ5L2Jsb2JieS1zcHJpdGVzaGVldHQuYXNlcHJpdGUKbGF5ZXJ8PUJsb2JieQpvcF9leHB8PUZhbHNlCm9fZm9sZGVyfD0Kb19uYW1lfD0Kb25seV92aXNpYmxlfD1GYWxzZQpvX2V4X3B8PQo="
}
@ -4572,5 +4571,5 @@ one_shot = true
[connection signal="got_grounded" from="BlobbyStateMachine" to="." method="_on_Blobby_got_grounded"]
[connection signal="timeout" from="BlobbyStateMachine/JumpBufferTimer" to="BlobbyStateMachine" method="_on_JumpBufferTimer_timeout"]
[connection signal="timeout" from="InvincibilityTimer" to="." method="_on_InvincibilityTimer_timeout"]
[connection signal="timeout" from="PitfallTimer" to="." method="die_for_real"]
[connection signal="timeout" from="PitfallTimer" to="." method="_on_PitfallTimer_timeout"]
[connection signal="timeout" from="PitfallTimer" to="." method="die_for_real" binds= [ -1 ]]

View File

@ -251,12 +251,13 @@ func reset_limits() -> void:
func _death_cam(animation_number: int = 0) -> void:
if animation_number < 1:
if animation_number == -1:
return
if animation_number == 0:
$CameraAnimationPlayer.play("deathCamJustZoom")
if animation_number == 1:
$CameraAnimationPlayer.play("deathCamLateRotation")
# TODO Rename to alarm lights specially
func _update_lighting_shader() -> void:
if !terminal_activated:

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=57 format=2]
[gd_scene load_steps=58 format=2]
[ext_resource path="res://src/Actors/BlobbyCam.gd" type="Script" id=1]
[ext_resource path="res://assets/environment/background/starry-space-near.png" type="Texture" id=2]
@ -557,6 +557,9 @@ tracks/9/keys = {
"values": [ false ]
}
[sub_resource type="Animation" id=23]
resource_name = "justRespawn"
[sub_resource type="Animation" id=11]
resource_name = "shiftingCenter"
length = 0.6
@ -910,6 +913,7 @@ anims/RESET = SubResource( 5 )
anims/deathCam = SubResource( 6 )
anims/deathCamJustZoom = SubResource( 15 )
anims/deathCamLateRotation = SubResource( 14 )
anims/justRespawn = SubResource( 23 )
anims/shiftingCenter = SubResource( 11 )
anims/shiftingLeft = SubResource( 12 )
anims/shiftingRight = SubResource( 13 )

View File

@ -135,14 +135,9 @@ func _on_StompDetector_body_entered(body: Node) -> void:
if body.is_in_group("player"):
attached_player = body
$FeelerRayCast.collision_mask -= 1
if !body.is_in_group("player") || is_hurt:
if !body.is_in_group("player") || is_hurt || !$StompTimeout.is_stopped():
return
var incoming_vel_vector: Vector2 = body.velocity.normalized()
# TODO This is not the right angle somehow
# print(rad2deg(abs(incoming_vel_vector.angle_to(Vector2.DOWN.rotated(rotation)))))
# if abs(incoming_vel_vector.angle_to(\Vector2.DOWN.rotated(rotation))) > deg2rad(60):
# print("too shallow entry")
# return
signal_manager.emit_signal("got_stomped")
remove_from_group("harmful")
# TODO Weakpoint group is not needed per se
@ -156,6 +151,7 @@ func _on_StompDetector_body_entered(body: Node) -> void:
func _on_StompDetector_body_exited(body: Node) -> void:
if attached_player == body:
$FeelerRayCast.collision_mask += 1
$StompTimeout.start()
attached_player = null
@ -511,6 +507,7 @@ func is_jump_path_safe(v: Vector2, pos: Vector2) -> bool:
var jump_distance = calculate_jump_distance(v)
var harmful_nodes = get_tree().get_nodes_in_group("harmful")
harmful_nodes.append_array(get_tree().get_nodes_in_group("pit"))
var result = true
for node in harmful_nodes:
var node_pos = node.global_position
# TODO Ignores spikes more than 4 blocks below and 3 jumps away
@ -531,12 +528,13 @@ func is_jump_path_safe(v: Vector2, pos: Vector2) -> bool:
var distance = abs(term1) + abs(term2)
# print("distance to next spike")
# print(pos.x + sign(v.x) * distance - node_pos.x)
var safe_distance = block_size / 2.0
# TODO absolutly set sprite size
var safe_distance = 24 / 2.0
if sign(initial_throw_height) < 0:
safe_distance = block_size
safe_distance = 24
if abs(pos.x + sign(v.x) * distance - node_pos.x) < safe_distance:
return false
return true
result = false
return result
func calculate_jump_height(v: Vector2) -> float:

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=50 format=2]
[gd_scene load_steps=51 format=2]
[ext_resource path="res://assets/enemy/froshler.png" type="Texture" id=1]
[ext_resource path="res://src/Actors/Friendlies/WhatAreFrog.gd" type="Script" id=2]
@ -420,25 +420,28 @@ states/sleeping/node = SubResource( 54 )
states/sleeping/position = Vector2( 177.848, 205.619 )
transitions = [ "idleHappy", "liftOff", SubResource( 27 ), "liftOff", "midJumping", SubResource( 28 ), "idleMean", "liftOff", SubResource( 29 ), "midJumping", "liftOff", SubResource( 30 ), "liftOff", "idleMean", SubResource( 31 ), "liftOff", "idleHappy", SubResource( 32 ), "idleHappy", "sleeping", SubResource( 55 ), "idleMean", "sleeping", SubResource( 56 ), "sleeping", "idleHappy", SubResource( 57 ), "sleeping", "idleMean", SubResource( 58 ) ]
start_node = "idleHappy"
graph_offset = Vector2( -379, -204 )
graph_offset = Vector2( -377, -42 )
[sub_resource type="AnimationNodeStateMachinePlayback" id=11]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 12, 9 )
extents = Vector2( 12, 6 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 12, 0.5 )
extents = Vector2( 12, 0.75 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 18.2143, 13.5955 )
[sub_resource type="RectangleShape2D" id=59]
extents = Vector2( 10, 15 )
extents = Vector2( 12, 15 )
[node name="WhatAreFrog" type="KinematicBody2D"]
[sub_resource type="RectangleShape2D" id=60]
extents = Vector2( 12, 0.53125 )
[node name="WhatAreFrog" type="KinematicBody2D" groups=["frog"]]
collision_layer = 2
collision_mask = 185
collision_mask = 184
collision/safe_margin = 0.002
script = ExtResource( 2 )
@ -481,6 +484,7 @@ position = Vector2( 0, -7 )
texture = ExtResource( 1 )
hframes = 2
vframes = 4
frame = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="FrogSprite"]
anims/RESET = SubResource( 5 )
@ -546,6 +550,7 @@ collision_mask = 297
collide_with_areas = true
[node name="EnemyBody" type="CollisionShape2D" parent="."]
position = Vector2( 0, 3 )
shape = SubResource( 1 )
[node name="cshape" type="Node2D" parent="."]
@ -564,7 +569,7 @@ input_pickable = false
monitorable = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="StompDetector"]
position = Vector2( 0, -0.875 )
position = Vector2( 0, 0.25 )
shape = SubResource( 2 )
[node name="GroundDetector" type="Area2D" parent="."]
@ -581,6 +586,7 @@ shape = SubResource( 2 )
[node name="EnemySkin" type="Area2D" parent="."]
process_priority = -1
visible = false
scale = Vector2( 0.7, 0.7 )
collision_layer = 2
collision_mask = 106
@ -593,14 +599,26 @@ shape = SubResource( 3 )
wait_time = 3.236
one_shot = true
[node name="StompTimeout" type="Timer" parent="."]
wait_time = 0.3
one_shot = true
[node name="JumpCollisionBody" type="KinematicBody2D" parent="."]
collision_layer = 2
visible = false
collision_layer = 0
collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="JumpCollisionBody"]
position = Vector2( 0, -6 )
shape = SubResource( 59 )
[node name="RideCollisionBody" type="KinematicBody2D" parent="."]
position = Vector2( 0, -7 )
collision_layer = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="RideCollisionBody"]
shape = SubResource( 60 )
[connection signal="body_entered" from="StompDetector" to="." method="_on_StompDetector_body_entered"]
[connection signal="body_exited" from="StompDetector" to="." method="_on_StompDetector_body_exited"]
[connection signal="area_entered" from="EnemySkin" to="." method="_on_EnemySkin_area_entered"]

View File

@ -78,7 +78,6 @@ uv = PoolVector2Array( 4.9375, 11.875, 5, 8.8125, 2.8125, 7, -0.375, 4.0625, 2.2
polygons = [ PoolIntArray( 0, 6, 7 ), PoolIntArray( 0, 1, 6 ), PoolIntArray( 1, 5, 6 ), PoolIntArray( 1, 2, 5 ), PoolIntArray( 2, 4, 5 ), PoolIntArray( 2, 3, 4 ) ]
[node name="Sprite" type="Sprite" parent="."]
visible = false
position = Vector2( 5.00909, 19.9567 )
z_index = -1
texture = ExtResource( 10 )

413
src/Levels/Legacy/huh.tscn Normal file

File diff suppressed because one or more lines are too long

View File

@ -277,7 +277,7 @@ position = Vector2( -70, 1 )
scale = Vector2( 0.878906, 0.936025 )
[node name="BlobbySprite" parent="Blobby" index="5"]
frame = 7
frame = 10
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
parameters/playback = SubResource( 14 )

View File

@ -134,7 +134,7 @@ position = Vector2( -70, -1.90735e-06 )
scale = Vector2( 0.878906, 0.936025 )
[node name="BlobbySprite" parent="Blobby" index="5"]
frame = 5
frame = 7
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
parameters/playback = SubResource( 6 )

View File

@ -131,11 +131,11 @@ drag_margin_bottom = 0.3
[node name="Blobby" parent="." instance=ExtResource( 11 )]
unique_name_in_owner = true
position = Vector2( -70, -1.90735e-06 )
position = Vector2( -64, -1.90735e-06 )
scale = Vector2( 0.878906, 0.936025 )
[node name="BlobbySprite" parent="Blobby" index="5"]
frame = 8
frame = 7
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
parameters/playback = SubResource( 6 )
@ -161,7 +161,7 @@ position = Vector2( -17, 0 )
position = Vector2( 816, -272 )
[node name="BoundFrog" parent="." instance=ExtResource( 16 )]
position = Vector2( 768, -219 )
position = Vector2( 769, -220 )
movement_radius = 6
[node name="TileMap" type="TileMap" parent="."]
@ -209,73 +209,88 @@ position = Vector2( 16, -207 )
position = Vector2( 336, -206 )
[node name="Spikes" parent="." instance=ExtResource( 20 )]
position = Vector2( 448, 176 )
position = Vector2( 447, 176 )
[node name="Spikes2" parent="." instance=ExtResource( 20 )]
position = Vector2( 480, 176 )
position = Vector2( 473, 176 )
[node name="Spikes3" parent="." instance=ExtResource( 20 )]
position = Vector2( 512, 176 )
position = Vector2( 499, 176 )
[node name="Spikes4" parent="." instance=ExtResource( 20 )]
position = Vector2( 544, 176 )
position = Vector2( 525, 176 )
[node name="Spikes5" parent="." instance=ExtResource( 20 )]
position = Vector2( 576, 176 )
position = Vector2( 551, 176 )
[node name="Spikes6" parent="." instance=ExtResource( 20 )]
position = Vector2( 608, 176 )
position = Vector2( 577, 176 )
[node name="Spikes7" parent="." instance=ExtResource( 20 )]
position = Vector2( 640, 176 )
position = Vector2( 603, 176 )
[node name="Spikes8" parent="." instance=ExtResource( 20 )]
position = Vector2( 672, 176 )
position = Vector2( 629, 176 )
[node name="Spikes9" parent="." instance=ExtResource( 20 )]
position = Vector2( 704, 176 )
position = Vector2( 655, 176 )
[node name="Spikes10" parent="." instance=ExtResource( 20 )]
position = Vector2( 736, 176 )
position = Vector2( 681, 176 )
[node name="Spikes11" parent="." instance=ExtResource( 20 )]
position = Vector2( 768, 176 )
position = Vector2( 707, 176 )
[node name="Spikes12" parent="." instance=ExtResource( 20 )]
position = Vector2( 800, 176 )
position = Vector2( 733, 176 )
[node name="Spikes13" parent="." instance=ExtResource( 20 )]
position = Vector2( 832, 176 )
position = Vector2( 759, 176 )
[node name="Spikes14" parent="." instance=ExtResource( 20 )]
position = Vector2( 864, 176 )
position = Vector2( 785, 176 )
[node name="Spikes15" parent="." instance=ExtResource( 20 )]
position = Vector2( 896, 176 )
position = Vector2( 811, 176 )
[node name="Spikes16" parent="." instance=ExtResource( 20 )]
position = Vector2( 928, 176 )
position = Vector2( 837, 176 )
[node name="Spikes17" parent="." instance=ExtResource( 20 )]
position = Vector2( 960, 176 )
position = Vector2( 863, 176 )
[node name="Spikes18" parent="." instance=ExtResource( 20 )]
position = Vector2( 992, 176 )
position = Vector2( 889, 176 )
[node name="Spikes19" parent="." instance=ExtResource( 20 )]
position = Vector2( 1024, 176 )
position = Vector2( 915, 176 )
[node name="Spikes20" parent="." instance=ExtResource( 20 )]
position = Vector2( 1056, 176 )
position = Vector2( 941, 176 )
[node name="Spikes21" parent="." instance=ExtResource( 20 )]
position = Vector2( 1088, 176 )
position = Vector2( 967, 176 )
[node name="Spikes22" parent="." instance=ExtResource( 20 )]
position = Vector2( 1120, 176 )
position = Vector2( 993, 176 )
[node name="Spikes23" parent="." instance=ExtResource( 20 )]
position = Vector2( 1152, 176 )
position = Vector2( 1019, 176 )
[node name="Spikes24" parent="." instance=ExtResource( 20 )]
position = Vector2( 1045, 176 )
[node name="Spikes25" parent="." instance=ExtResource( 20 )]
position = Vector2( 1071, 176 )
[node name="Spikes26" parent="." instance=ExtResource( 20 )]
position = Vector2( 1097, 176 )
[node name="Spikes27" parent="." instance=ExtResource( 20 )]
position = Vector2( 1123, 176 )
[node name="Spikes28" parent="." instance=ExtResource( 20 )]
position = Vector2( 1149, 176 )
[node name="Coin" parent="." instance=ExtResource( 21 )]
position = Vector2( 720, 24 )

View File

@ -197,7 +197,7 @@ position = Vector2( -38, 0 )
scale = Vector2( 0.878906, 0.936025 )
[node name="BlobbySprite" parent="Blobby" index="5"]
frame = 9
frame = 7
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
parameters/playback = SubResource( 6 )

File diff suppressed because one or more lines are too long

View File

@ -120,7 +120,7 @@ position = Vector2( -70, -1.90735e-06 )
scale = Vector2( 0.878906, 0.936025 )
[node name="BlobbySprite" parent="Blobby" index="5"]
frame = 6
frame = 7
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
parameters/playback = SubResource( 6 )

View File

@ -4,7 +4,7 @@
[ext_resource path="res://assets/obstacle object/speiku/speiku16.png" type="Texture" id=23]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 11, 11 )
extents = Vector2( 9, 9.25 )
[node name="Spikes" type="StaticBody2D"]
collision_layer = 8
@ -17,3 +17,5 @@ texture = ExtResource( 23 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[editable path="DangerousBlockArea"]

View File

@ -41,7 +41,7 @@ resource_name = "LowPassFilter"
cutoff_hz = 3000.0
[resource]
bus/0/volume_db = -13.9794
bus/0/volume_db = inf_neg
bus/1/name = "Music"
bus/1/solo = false
bus/1/mute = false

View File

@ -255,8 +255,6 @@ follow_focus = true
[node name="ActionKeyList" type="VBoxContainer" parent="Panel/KeymapViewer/ScrollContainer"]
unique_name_in_owner = true
margin_right = 600.0
margin_bottom = 189.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 14 )