0 votes

I have a one shot particle effect that doesn't show up when I load the second scene to the right of the current scene. If I play the scene by itself the particle effect works when I run into an object. The Area2D "body_entered" still works, but it think's it's position is one screen size to the left so I have to do something like this:

#coin.gd

const SCREEN_X = 480        

func _ready():
    glo = get_node("/root/global")  
    particle_packed = preload("res://env//script_obj//coin_particle.tscn")
    get_node("Area2D").connect("body_entered", self, "trigger_enter")

func trigger_enter(body):
    if body.get_name() == 'player':
        var particle = particle_packed.instance()
        particle.position = position
        particle.position.x += SCREEN_X * (glo.current_level -1) #why this
        get_tree().root.add_child(particle)
        glo.coin_found()
        queue_free()
asked Aug 8 in Engine by talador (16 points)

What is glo and particle_packed? I don't see them defined anywhere.
Also I don't fully understand the problem or how it happens.
Is your coin_particle.tscn scene centered at the origin?
Also are you sure the position you set it to is actually correct, relative to the parent of your nodes? (verify what's local and global)

Please log in or register to answer this question.

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.