fix: frog jump into narrow pits, permanent coin collection
This commit is contained in:
parent
e4aa8d0470
commit
1d55756ade
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
@ -346,20 +346,14 @@ func jump():
|
||||
# and let it fail if the top is dangerous for jump height or not safe
|
||||
v = consider_jumping_on_top()
|
||||
if v == zero_vector && jump_into_narrow_pit:
|
||||
v = consider_jump_landing_space(v, jump_into_narrow_pit)
|
||||
var default_velocity = velocity_for_jump_distance(default_jump_distance)
|
||||
v = consider_jump_landing_space(default_velocity, jump_into_narrow_pit)
|
||||
if v == zero_vector && can_reverse_facing_direction():
|
||||
reverse_facing_direction()
|
||||
|
||||
# if attached_player != null && v != zero_vector:
|
||||
# move_with_player(v)
|
||||
|
||||
velocity = v
|
||||
|
||||
|
||||
#func move_with_player(v: Vector2):
|
||||
# print(v)
|
||||
# attached_player.move_and_slide(v * 10)
|
||||
|
||||
|
||||
func correct_jump_direction(v: Vector2) -> Vector2:
|
||||
if sign(v.x) != get_facing_direction():
|
||||
@ -401,7 +395,7 @@ func consider_jump_headspace(v: Vector2, recursive_check_count = 0, max_checks =
|
||||
# Check the block in jump distance for danger or height
|
||||
# If danger check neighboring blocks: if still danger, then jump closer (or jump over)
|
||||
# If height move to distance which allows 1 block high jump
|
||||
func consider_jump_landing_space(v: Vector2, jump_into_narrow_pit = false) -> Vector2:
|
||||
func consider_jump_landing_space(v: Vector2, into_narrow_pit = false) -> Vector2:
|
||||
var jump_distance = calculate_jump_distance(v)
|
||||
var jump_height = calculate_jump_height(v)
|
||||
var collider = check_feeler(Vector2(jump_distance * get_facing_direction(), -jump_height / 2))
|
||||
@ -420,9 +414,12 @@ func consider_jump_landing_space(v: Vector2, jump_into_narrow_pit = false) -> Ve
|
||||
v = correct_jump_direction(v)
|
||||
collider = check_feeler(Vector2(jump_distance * get_facing_direction(), -jump_height / 2))
|
||||
if (
|
||||
(!is_jump_path_safe(v, global_position) || (collider != null && !jump_into_narrow_pit))
|
||||
(!is_jump_path_safe(v, global_position) || (collider != null && !into_narrow_pit))
|
||||
&& can_reverse_facing_direction()
|
||||
):
|
||||
print(is_jump_path_safe(v, global_position))
|
||||
print(can_reverse_facing_direction())
|
||||
print(into_narrow_pit)
|
||||
# Can be printed when frog would jump into a wall too
|
||||
print("at wall or no safe landing spot")
|
||||
return Vector2(0, 0)
|
||||
|
||||
@ -53,7 +53,7 @@ tracks/1/keys = {
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=6]
|
||||
[sub_resource type="Animation" id=61]
|
||||
resource_name = "idleHappyLeft"
|
||||
length = 1.62
|
||||
loop = true
|
||||
@ -321,7 +321,7 @@ animation = "idleHappyLeft"
|
||||
[sub_resource type="AnimationNodeAnimation" id=43]
|
||||
animation = "idleHappy"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace1D" id=9]
|
||||
[sub_resource type="AnimationNodeBlendSpace1D" id=62]
|
||||
blend_point_0/node = SubResource( 42 )
|
||||
blend_point_0/pos = -1.0
|
||||
blend_point_1/node = SubResource( 43 )
|
||||
@ -408,7 +408,7 @@ auto_advance = true
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id=58]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id=10]
|
||||
states/idleHappy/node = SubResource( 9 )
|
||||
states/idleHappy/node = SubResource( 62 )
|
||||
states/idleHappy/position = Vector2( -58.7619, 98.0433 )
|
||||
states/idleMean/node = SubResource( 20 )
|
||||
states/idleMean/position = Vector2( 451.952, 98.0432 )
|
||||
@ -487,7 +487,7 @@ vframes = 4
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="FrogSprite"]
|
||||
anims/RESET = SubResource( 5 )
|
||||
anims/idleHappy = SubResource( 4 )
|
||||
anims/idleHappyLeft = SubResource( 6 )
|
||||
anims/idleHappyLeft = SubResource( 61 )
|
||||
anims/idleMean = SubResource( 12 )
|
||||
anims/idleMeanLeft = SubResource( 13 )
|
||||
anims/liftOff = SubResource( 14 )
|
||||
|
||||
@ -17,6 +17,7 @@ func _ready() -> void:
|
||||
|
||||
if was_collected:
|
||||
visible = false
|
||||
level_state.set_currency(level_state.get_currency() + currencyValue)
|
||||
|
||||
func _on_body_entered(_body: Node) -> void:
|
||||
if was_collected == true:
|
||||
|
||||
@ -1329,7 +1329,7 @@ position = Vector2( -70, 1 )
|
||||
scale = Vector2( 0.878906, 0.936025 )
|
||||
|
||||
[node name="BlobbySprite" parent="Blobby" index="5"]
|
||||
frame = 9
|
||||
frame = 6
|
||||
|
||||
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
|
||||
parameters/playback = SubResource( 33 )
|
||||
|
||||
@ -1169,7 +1169,7 @@ position = Vector2( -156, -51 )
|
||||
scale = Vector2( 0.878906, 0.936025 )
|
||||
|
||||
[node name="BlobbySprite" parent="Blobby" index="5"]
|
||||
frame = 7
|
||||
frame = 5
|
||||
|
||||
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
|
||||
parameters/playback = SubResource( 6 )
|
||||
|
||||
@ -128,7 +128,7 @@ death_sound_1 = null
|
||||
death_sound_2 = null
|
||||
|
||||
[node name="BlobbySprite" parent="Blobby" index="5"]
|
||||
frame = 6
|
||||
frame = 5
|
||||
|
||||
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
|
||||
parameters/playback = SubResource( 7 )
|
||||
|
||||
@ -191,7 +191,7 @@ death_sound_1 = null
|
||||
death_sound_2 = null
|
||||
|
||||
[node name="BlobbySprite" parent="Blobby" index="5"]
|
||||
frame = 7
|
||||
frame = 5
|
||||
|
||||
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
|
||||
parameters/playback = SubResource( 53 )
|
||||
|
||||
@ -128,12 +128,9 @@ drag_margin_bottom = 0.3
|
||||
|
||||
[node name="Blobby" parent="." instance=ExtResource( 11 )]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2( -64, -2.84217e-14 )
|
||||
position = Vector2( 857, -266 )
|
||||
scale = Vector2( 0.878906, 0.936025 )
|
||||
|
||||
[node name="BlobbySprite" parent="Blobby" index="5"]
|
||||
frame = 7
|
||||
|
||||
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
|
||||
parameters/playback = SubResource( 6 )
|
||||
|
||||
|
||||
@ -185,9 +185,6 @@ unique_name_in_owner = true
|
||||
position = Vector2( -45, -5.96046e-08 )
|
||||
scale = Vector2( 0.878906, 0.936025 )
|
||||
|
||||
[node name="BlobbySprite" parent="Blobby" index="5"]
|
||||
frame = 9
|
||||
|
||||
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
|
||||
parameters/playback = SubResource( 6 )
|
||||
|
||||
@ -258,32 +255,32 @@ speed = 40
|
||||
[node name="GateButton" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 232, -18 )
|
||||
|
||||
[node name="GateBlock" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( -76, -8 )
|
||||
[node name="GateBlock" parent="GateButton" instance=ExtResource( 17 )]
|
||||
position = Vector2( -308, 10 )
|
||||
|
||||
[node name="GateBlock2" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( -76, -24 )
|
||||
[node name="GateBlock2" parent="GateButton" instance=ExtResource( 17 )]
|
||||
position = Vector2( -308, -6 )
|
||||
|
||||
[node name="GateBlock6" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( -76, -40 )
|
||||
[node name="GateBlock6" parent="GateButton" instance=ExtResource( 17 )]
|
||||
position = Vector2( -308, -22 )
|
||||
|
||||
[node name="GateBlock3" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( 260, -8 )
|
||||
[node name="GateBlock3" parent="GateButton" instance=ExtResource( 17 )]
|
||||
position = Vector2( 28, 10 )
|
||||
|
||||
[node name="GateBlock4" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( 260, -24 )
|
||||
[node name="GateBlock4" parent="GateButton" instance=ExtResource( 17 )]
|
||||
position = Vector2( 28, -6 )
|
||||
|
||||
[node name="GateBlock5" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( 260, -40 )
|
||||
[node name="GateBlock5" parent="GateButton" instance=ExtResource( 17 )]
|
||||
position = Vector2( 28, -22 )
|
||||
|
||||
[node name="GateBlock7" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( 532, 8 )
|
||||
[node name="GateBlock7" parent="GateButton" instance=ExtResource( 17 )]
|
||||
position = Vector2( 300, 26 )
|
||||
|
||||
[node name="GateBlock8" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( 532, -8 )
|
||||
[node name="GateBlock8" parent="GateButton" instance=ExtResource( 17 )]
|
||||
position = Vector2( 300, 10 )
|
||||
|
||||
[node name="GateBlock9" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( 532, -24 )
|
||||
[node name="GateBlock9" parent="GateButton" instance=ExtResource( 17 )]
|
||||
position = Vector2( 300, -6 )
|
||||
|
||||
[node name="Mine11" parent="." instance=ExtResource( 13 )]
|
||||
position = Vector2( 527, 452 )
|
||||
@ -375,6 +372,9 @@ position = Vector2( 1010, -303 )
|
||||
[node name="Coin3" parent="." instance=ExtResource( 11 )]
|
||||
position = Vector2( 1124, 242 )
|
||||
|
||||
[node name="Coin4" parent="." instance=ExtResource( 11 )]
|
||||
position = Vector2( 408, -1 )
|
||||
|
||||
[node name="ElevatorButton" parent="." instance=ExtResource( 7 )]
|
||||
position = Vector2( -102, -16 )
|
||||
elevator_time = 70
|
||||
|
||||
@ -41,7 +41,7 @@ resource_name = "LowPassFilter"
|
||||
cutoff_hz = 3000.0
|
||||
|
||||
[resource]
|
||||
bus/0/volume_db = -4.43698
|
||||
bus/0/volume_db = inf_neg
|
||||
bus/1/name = "Music"
|
||||
bus/1/solo = false
|
||||
bus/1/mute = false
|
||||
|
||||
@ -40,13 +40,12 @@ script = ExtResource( 3 )
|
||||
[node name="background" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 46.0
|
||||
margin_bottom = 46.0
|
||||
texture = ExtResource( 10 )
|
||||
expand = true
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="background2" type="TextureRect" parent="."]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = ExtResource( 4 )
|
||||
@ -54,6 +53,7 @@ expand = true
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="GradientTexture" type="TextureRect" parent="."]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = SubResource( 17 )
|
||||
|
||||
@ -68,13 +68,12 @@ script = ExtResource( 15 )
|
||||
[node name="background" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 46.0
|
||||
margin_bottom = 46.0
|
||||
texture = ExtResource( 10 )
|
||||
expand = true
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="background2" type="TextureRect" parent="."]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = ExtResource( 9 )
|
||||
|
||||
@ -59,13 +59,14 @@ script = ExtResource( 14 )
|
||||
[node name="background" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -128.0
|
||||
margin_bottom = -128.0
|
||||
margin_top = 1.0
|
||||
margin_bottom = 1.0
|
||||
texture = ExtResource( 7 )
|
||||
expand = true
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="background2" type="TextureRect" parent="."]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = ExtResource( 6 )
|
||||
|
||||
Loading…
Reference in New Issue
Block a user