block bouncing a mushroom, now changes its direction, if at an edge.

This commit is contained in:
JHDev2006
2025-09-21 14:03:39 +01:00
parent 321ebb8e6b
commit 6013a7da77
3 changed files with 7 additions and 2 deletions

View File

@@ -75,4 +75,4 @@ movement_node = NodePath("../BasicEnemyMovement")
metadata/_custom_type_script = "uid://d4a7yp6e55u8t" metadata/_custom_type_script = "uid://d4a7yp6e55u8t"
[connection signal="area_entered" from="Hitbox" to="." method="on_area_entered"] [connection signal="area_entered" from="Hitbox" to="." method="on_area_entered"]
[connection signal="block_bounced" from="BlockBouncingDetection" to="." method="block_bounce_up" unbinds=1] [connection signal="block_bounced" from="BlockBouncingDetection" to="." method="block_bounce_up"]

View File

@@ -27,7 +27,8 @@ func on_area_entered(area: Area2D) -> void:
if area.owner is Player: if area.owner is Player:
collect_item(area.owner) collect_item(area.owner)
func block_bounce_up() -> void: func block_bounce_up(block: Node2D) -> void:
direction = -sign(block.global_position.x - global_position.x + 0.1)
velocity.y = -200 velocity.y = -200
func block_dispense_tween() -> void: func block_dispense_tween() -> void:

View File

@@ -337,6 +337,10 @@ func check_for_medal_achievement() -> void:
has_silver_levels_any = false has_silver_levels_any = false
if best_level_any_times[i] > LEVEL_GOLD_ANY_TIMES[Global.current_campaign][i] * MEDAL_CONVERSIONS[0]: if best_level_any_times[i] > LEVEL_GOLD_ANY_TIMES[Global.current_campaign][i] * MEDAL_CONVERSIONS[0]:
has_bronze_levels_any = false has_bronze_levels_any = false
else:
has_gold_levels_any = false
has_silver_levels_any = false
has_bronze_levels_any = false
var world := 0 var world := 0
for i in best_level_warpless_times: for i in best_level_warpless_times: