Created
January 7, 2014 11:13
-
-
Save Tom-Ski/8297936 to your computer and use it in GitHub Desktop.
Pooled objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public TempBodyPool(final World world, final Level level) { | |
toastParticles = new Pool<ToastParticle>() { | |
@Override | |
protected ToastParticle newObject() { | |
return new ToastParticle(world, 1, 1f, 1f, 1, 0.5f, 0.2f); | |
} | |
}; | |
cerealParticles = new Pool<CerealParticle>() { | |
@Override | |
protected CerealParticle newObject() { | |
return new CerealParticle(world, 2, 0.3f, 0.3f, 1, 0.5f, 0.2f); | |
} | |
}; | |
owParticles = new Pool<OwParticle>() { | |
@Override | |
protected OwParticle newObject() { | |
float sizeX = rand.nextInt(10) / 10; | |
float sizeY = rand.nextInt(10) / 10; | |
return new OwParticle(world, 2, 1f + sizeX, 0.5f + sizeY, 0.2f + (rand.nextFloat() / 5), level.getWordBank().getRandomWord()); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment