T
TheEffingLaw

Player not falling when platform disappears

Not sure why this is happening, but after the platform disappears my character does not fall but just floats on the platform.


extends StaticBody2D
onready var animation_player = $AnimationPlayer
onready var player_detector = $PlayerDetector
func _ready() -> void:
player_detector.connect("body_entered", self, "_on_Player_detector_body_entered")
func _on_Player_detector_body_entered(body : Node) -> void:
animation_player.play("fade")



  • T
    TheEffingLaw replied

    Okay I figured it out, I had the collision shape2d checkbox turned off. I thought I needed that unchecked to have the initial collision.


  • S
    Kseniia Kuziaeva (Susssu) replied

    I'm having the same issue. I've triple checked the animation player, cod, collision shapes. Maybe there's something I'm missing? Please help!


    3-04-21 16-53-15.png3-04-21 16-51-04.png3-04-21 16-50-41.png3-04-21 16-50-20.png


    extends StaticBody2D

    onready var animation_player := $AnimationPlayer
    onready var player_detector := $PlayerDetector

    func _ready() -> void:
    player_detector.connect("body_entered", self, "_on_PlayerDetector_body_entered")

    func _on_PlayerDetector_body_entered(body: Node) -> void:
    animation_player.play("fade")

    I've tried remaking the animation player. The platform now disappears and the robot falls from it but only once. Stepping on it once more doesn't trigger any animation.

    EDIT

    In order to fix it I had to add following code, connecting the animation finished signal to the animation player:

    func _on_AnimationPlayer_animation_finished(anim_name):
    if anim_name == "fade":
    animation_player.play("RESET")

    Maybe it will help someone.

    1 love