This site requires JavaScript, please enable it in your browser!
Greenfoot back
truck_hunt97
truck_hunt97 wrote ...

2022/5/25

Hi i need held thanks in advance

truck_hunt97 truck_hunt97

2022/5/25

#
Hello, I need help. I want to make a store in my game to buy positions, because I want to make it so that when the player can click on the position that he wants to use, the effect is saved in a variable that is activated by pressing a key. and this will have an obvious price that can be bought until you have enough coins thanks in advance.don't worry about the effect I just need the code to be able to make the effect activate when you click it and that you can buy it having the necessary coins
Spock47 Spock47

2022/5/25

#
Please have a look at https://www.greenfoot.org/topics/64967/0 There is a menu to choose which ship the hero is flying. You can reuse it for your idea, especially adding buttons for each position to the chooser-menu. At the button action, you can also add a check whether the hero has enough coins and the reduction of coins when the number of coins is sufficient. You can also add booleans to the hero class to indicate whether the effects are already bought. Please let me know whether this helps, otherwise just add additional questions as response here to resolve any remaining problems.
You need to login to post a reply.