[SOLVED] I want to scale ParticleEffect - Libgdx

Basically my problem is simple - I have a ParticleEffect which looks nice on small screen but on my private phone (Samsung S4) it looks very small. My question is: How can I scale the effect?

I have already done something like this:

// Callback method
	public void addEffect(Vector2 position, boolean special) {
		// Callback Method for the particle effects
		PooledEffect effect;
		if (!special)
			effect = (MathUtils.random(0, 1) == 0) ? yellow_star_pool.obtain()
					: green_star_pool.obtain();
		else
			effect = special_star_pool.obtain();
		effect.setPosition(position.x, position.y);
		effect.scaleEffect(Values.Scalar_Width*1.3f);
		effects.add(effect);
	}

But the result is that the effect is scaling exponentially, something I don’t want.

I just want the effect to be scaled so that it will look the same on all screens. How can I achieve that?

UPDATE: Ok I managed to solve this by simply reset the effect pools at the end of each effect. In that way, the pools doesn’t grow exponentially.

What is the value of “Values.Scalar_Width”? You need to likely take screen density into account. The S4 isn’t the highest density screen either. IE I just got the Nexus 6 for instance. These are Android system values from DisplayMetrics:

Nexus 6:
density: 3.5
densityDpi: 560
scaledDensity: 3.5
xdpi: 494.27
ydpi: 492.606
widthPixels: 2413
heightPixels: 1440

Nexus 5:
density: 3.0
densityDpi: 480
scaledDensity: 3.0
xdpi: 442.451
ydpi: 443.345
widthPixels: 1794
heightPixels: 1080

You get them by getting a DisplayMetrics instance for the desired screen:

      
DisplayMetrics displayMetrics = new DisplayMetrics();
((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(
displayMetrics);

You can use any Context (Activity / Application) to call getSystemService.

Granted this is the solution for Android. You’ll want to find a value with some of the factors returned by DisplayMetrics and set “scaleEffect” accordingly.

Values.Scalar_Width is a value which helps me to determine the size of entities in the game so that they will look pretty much the same on all screens.

And never mind. I managed to solve this by simply reset the pools at the end of the effect.