0 votes

I wanna attach a particle to my character's double jump but i'm stuck at showing and hiding the effect when the character has jumped on its second jump. I've tried many different ways to do this but none of them worked, the closest I've gotten was this script here. If you want to suggest a whole different or better script for it then please do! Thanks!

    if Input.is_action_just_pressed("ui_up"):
    if on_ground == true:
        vel.y = JumpP 
        HDJ = false
        on_ground = false

elif on_ground == false && HDJ == false:
    vel.y = JumpP
    HDJ = true
if on_ground == false && HDJ == false && Input.is_action_just_pressed("ui_up"):
    DJ = DJ + 1
    if DJ == 2:
        $Double.visible = $Double.visible
        if on_ground == true:
            DJ = 0
        $Double.visible = not $Double.visible
in Engine by (15 points)

1 Answer

+1 vote
Best answer

You're not toggling visible correctly. $Double.visible = $Double.visible won't do anything and $Double.visible = not $Double.visible sets visible to the opposite value. It needs to be $Double.visible = true/false.

However toggling visibility will have the particle simply appear and disappear. For a better effect I'd recommend using $Double.emitting = true/false instead.

by (3,213 points)
selected by

Thanks so much! This helped!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.