Hi all, I'm stuck on a way to get a function to reference a particular sprite which will change each time the function is called.
I have a game which features small mini games for kids. At the end of each game a pop up window appears to say "well done! you made 3 cup cakes!" or whatever the child is doing.
I created a function to create the pop up and reference the appropriate text from a dictionary so that all the mini games can use the same function and just pass parameters for the text string required, and also pass a parameter of the score value. This all works fine but now I'm trying to get clever and show the score number not as text but as a graphic - i.e. a sprite - so it looks big and pretty and has animation.
The problem is how to pass the number sprite to the function so it can create and position it in the pop up window. I have 10 Sprites - the numbers 0 to 9. AFAIK I cannot pass a sprite (or other object) in a function parameter.
I tried grouping the sprites in a family, and giving the family an instance variable which has the number the sprite represents (so the number 9 is set to 9, for example). Then I passed the score value as a numeric parameter and tried a Pick by evaluation, comparing the instance variable to the passed score parameter which should pick the right sprite, but after that I'm a bit stumped how to get that to show and position the sprite. the Create function just creates a random member of the family even after the picking process.
Any other suggestions to pass a sprite to be created/positioned to a function?
Thanks for any advice!