I have been extending arcade groups to make a pool of items for a game, i’m using this.createMultiple to do so but would like to use this same approach to make a pool of different items, I’d like to have different sprites in this pool of items and maybe even different configurations details like points and so on.
So far i feel like i can only really specify one sprite for the whole group, is this true? Or is there a way for me to specify a array of sprites to use for this.
So some background, i’ve been using the following code as a basis for this project
I was hoping i could use something like the following
class LaserGroup extends Phaser.Physics.Arcade.Group
{
constructor(scene, keys) {
super(scene.physics.world, scene);
this.createMultiple({
frameQuantity: 30,
key: Phaser.Math.RND.pick(keys),
active: false,
visible: false,
classType: Fruit
});
}
}
Where keys
is an array of the sprites to use, for example keys = [‘apple’, ‘cherry’, ‘banana’]
I’m probably missing how the createMultiple method works here so if anyone could help me out or even point me in the directions of an example or method i could use to achieve what i’m looking for?
Thanks.