public Star generateStar(int mode, boolean changeColors) { int type = (int) (Math.random() * mAnimation.length); Vector2 mPosition = Vector2.ZERO.cpy(); Star result = new Star(mAnimation[type], mPosition, type + 2, lockY); result.setGravityCenterSpeed(mGravityCenterSpeed); resetStar(result, mode, changeColors); return result; }
public void resetStar(Star mStar, int mode) { float x, y; switch (mode) { case GenMode.NORMAL: x = (float) (Math.random() * w); y = (float) (Math.random() * h); break; case GenMode.TOP: x = (float) (Math.random() * w); y = (float) ((Math.random() * 2 - 1) * margine); break; default: x = (float) (Math.random() * w); y = (float) (Math.random() * h); break; } mStar.getPosition().x = x; mStar.getPosition().y = y; mStar.getGravityCenter().x = x; mStar.getGravityCenter().y = y; mStar.getSpeed().x = 0; mStar.getSpeed().y = 0; }
public void resetStar(Star mStar, int mode, boolean changeColors) { resetStar(mStar, mode); mStar.setChangeColor(changeColors); }