Particle Effect Scaling

Godot Version

Godot v4.5.1

Question

Hello All,

I’m pretty new to game development in general, so I’m still learning the ropes.

I’m trying to create a fishing game, and the plan is for the fish to look similar to animal crossing, where it’s sort of just a dark circle with a tail. I wanted to create this using a circle with a particle emitter attached, emitting the same sprite but reducing in size over it’s lifetime via a curve.

I also have a difficulty system in mind, and I want the fish to vary in size based on another curve where most fish will be small with occasional larger ones, increasing as time goes on.

The problem I am having is how these two interact. Because the particle system curve is built into the process material, I think it is overwriting the scaling entirely. My spawn code looks like this, activating on a repeating timer timeout. The enemy.scale is working on the Node2D, but not the tail (particle effect) so I added the tail.scale line and I’m still having trouble.

func spawn_fish():
	#Get Fish Node(s)
	var enemy = preload("res://Fish/Fish.tscn").instantiate()
	var tail = enemy.get_node("Tail") as GPUParticles2D
	
	#Set Spawn Position
	%SpawnPath.progress_ratio = randf()
	enemy.global_position = %SpawnPath.global_position
	#Modify Size
	var difficulty: float = 1.0 + (Global.difficulty * .15)
	var sample = randf()
	var size = SizeCurve.sample(sample)
	var final_size = Vector2.ONE * difficulty * size
	
	#Create enemy and set size
	add_child(enemy)
	tail.scale = final_size
	enemy.scale = final_size

The visual result is a bunch of fish shapes that are all the same size and at a lower framerate because the framerate is essentially the emission rate of the particle system. Any advice?

Hi baconsaver45!

Could you be more specific for which visual result you are going? You could maybe provide a video or a screenshot of the desired effect.

I think if you don’t need multiple similar particles and if you only want to reduce the size, one single scene should be enough for achieving it.

Could you tell me why this is not your desired visual result?

Kind regards :four_leaf_clover:

Looks like I’m too new to the forum to upload clips unfortunately.
The desired effect basically looks like a circle with a tail that tapers off until it is gone, similar to the look of the underwater fish in this clip: https://www.youtube.com/shorts/_cje1NC6Bnc

I have a single scene that encompasses the fish. it includes a sprite, a collision area, and the particle effect. Part of the problem is that the particles won’t scale uniquely. Each time a new fish spawns, all of the other fish’s tails update to the size of the most recent fish. Additionally, if the newest fish is really big, it creates a harsh stuttering effect on smaller fish because the large particle effect completely covers the original sprite.

I want the particles to sort of mimic the effect of the tail in the clip I sent above. I want the fish to move smoothly and I want the different sizes to stay the correct size as new fish spawn.

Thank you for your reply, please let me know if I can clarify anything further!

Make the particle process material resource local to scene.

This worked, thank you!

1 Like