How to create scene to buy character from the coins in the game?

chongyunxiang

  • Posts: 216
Hi,
I am able earn coins in the game which I would like the player to use to buy characters. When the character is locked, if the player clicks on it, it'll create a buy button. But I'm unable to buy it.

What's a good way to create a buy scenario where:
1) Display a "Block" frame of locked character.
2) Display a Buy description & button when player clicks on locked characters.
3) If coins is not enough, disable the buy button.
4) If coins is sufficient, enable buy button.
5) If player clicks on enabled buy button, kill buy and description, display "Unlocked" frame of character in selection screen.

So far, I'm able to accomplish 1 & 2. But I think my code is only applicable to 1 character. If I attach the same behaviour to another character, it won't work. I'll have to create another button with the same code.

Thanks!

chongyunxiang

  • Posts: 216
*UPDATE*

I'm now currently able to accomplish this:

1) Display a "Block" frame of locked character.
2) Display a Buy description & button when player clicks on locked characters.
3) If coins is not enough, disable the buy button.
4) If coins is sufficient, enable buy button.

As for the 5th one, I worked my way around it and found an alternative for it instead.

But my Buy button behaviour is still only programmed to 1 character.
How do I make the Buy button universal?

Thanks!