I have created a function to do the some code creating multiple enemies however it is only creating one. when i have this code outside of the function it creates multiple sprites, can anyone please help as I am unsure why this is happening and what I can do to change this interaction.
Ok so I’ve figured out a way of doing it. A little messy but it works.
I pass a sprite into the function,
I also define/set a sprite in the function, then change the image of the function sprite to that of the one in the parameter.
And then destroy the parameter sprite.
I would actually like to pass in an animation to the function. Is that possible? I can add them all to an array and the iterate through it outside of the function but my idea was to have this function create multiple rows of different sprites.