Godot Engine

Godot Engine

Partickes2D Emitting
how to reproduce particles when picking up a coin? just write specific lines, no need to try to explain

NO, $ Partickes2D.emitting = true DOES NOT WORK
En son жовтогарячий tarafından düzenlendi; 26 Kas 2022 @ 14:25
< >
10 yorumdan 1 ile 10 arası gösteriliyor
This is Not enough information. if Particles2D are a child of the coin and you are removing the coin obviously that line of code Won't work.
Really hard to say without knowing what you are doing right now to know what's wrong.

Here's how I'd go about it:
Coin Picked up pseudo code:
If Picked up - change to Particles
or
If Picked up - Add Child Particles to Coin, Remove Child Particles From Coin, Pass the Child to Root, Tell Root to Spawn that Passed Child (as in Reparent from Coin to Root)

Just adding particles to coin will result in no particles if the coin is deleted because the particles are a child of the coin and all of the children of the coin are removed.
you should look up the Docs in godot, they've got all the methods you'll need there, and the parameters that you need.
The methods you should look at are:
1.
replace_by()

2.
add_child()
remove_child()
connect()
get_parent()
The Particle Node Reference for the Particle Effect that you want to replace it by... same thing as if you were to use add_child()
var coin=load(insert coin resource (.tscn/.scn))
var child=coin.instance()
add_child(child)
İlk olarak Розочка Ризотто tarafından gönderildi:
İlk olarak Baroon Valm tarafından gönderildi:
The Particle Node Reference for the Particle Effect that you want to replace it by... same thing as if you were to use add_child()

I can't use Add_child either, I don't know what to write in brackets

The first option seems to me more concise, so I decided to use it.
I read the documentation and didn't understand anything. What is written there is intended for people who already understand something in coding, but this is clearly not me. I'm more of an artist.

you would really benefit a lot from working your way through the examples in the docs. you should come away from that understanding everything the above posters have just said.

its worth your time, trust me ;)
İlk olarak Розочка Ризотто tarafından gönderildi:
just write specific lines, no need to try to explain
That's the wrong attitude, because if other people just write your code for you, you won't understand why it works and if it breaks you can't fix it.
And we can't just write lines out of thin air if we don't understand what your code is, so maybe do us the favor of posting what you have, then maybe we can explain what's wrong so you can fix it.

İlk olarak Розочка Ризотто tarafından gönderildi:
I don't understand what needs to be written in parentheses after replace_by so that after the coin is removed the particle effect is reproduced
That's why everyone tells you to look at the documentation, because that's the purpose of the documentation.

İlk olarak Розочка Ризотто tarafından gönderildi:
I read the documentation and didn't understand anything. What is written there is intended for people who already understand something in coding, but this is clearly not me. I'm more of an artist.
Then maybe first learn the basics and then start actually working on code. If you can't work with the documentation, we can't help you much either.

Sorry if I sound rude, but trying to code without understanding code and more importantly - without wanting to understand code - is a fool's errand and won't get you far.
Regarding the add_child and replace_by functions. you're supposed to add a node into it, in this case your particle emitter. You can either use load("path_to_scene").instance() to create a new node or if it's already there on runtime get_tree().get_root().get_node("name_of_the_node") to fetch it out of the SceneTree
You could instance a particle emmiter 2d scene
< >
10 yorumdan 1 ile 10 arası gösteriliyor
Sayfa başına: 1530 50

Gönderilme Tarihi: 18 Haz 2021 @ 23:14
İleti: 10