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

2015/10/29

Help me with my code

kalayamosu kalayamosu

2015/10/29

#
My task is to create a simple incremental game. It will take the form of one large button – each click of this button will award the player with a point. My game should show me how many points the player has earned this way. I will also need to provide a ‘shop’ from which players can buy upgrades. These will increase the number of points gained by clicks, or give some ‘passive’ point generation. Each time an upgrade is purchased, the cost goes up. The two types of upgrade I must provide are: 1. Click Enhancement, which increases the number of points gained per click by one for each time the upgrade has been purchased. 2. Passive Click Generation, which generates X point(s) per Y second(s), every time the upgrade has been purchased. When the player has gained 20 points, they can buy a Super Click upgrade, which will then give them two points every time the button is clicked. The next Super Click upgrade will cost 22 points, and give them 3 points per click. Upon getting 100 points, they can buy a click factory which gives them one point every ten seconds. The second click factory will cost them 150 points. The third will cost them 225 points (1.5 x 150). Your program will need to perform the following operations: • Set up the GUI; • Set up a program loop to handle each of the passive click upgrades; • Create a ‘shop’ interface that allows for upgrades to be purchased; • Handle game state for the number of points a player has gained, and how many of each upgrade they have purchased; • Provide a shop through which power-ups can be purchased; • Correctly calculate number of points gained based on all existing purchased upgrades; • Correctly calculate the cost of upgrades based on base cost and cost increment.
lordhershey lordhershey

2015/10/29

#
Sounds like you have it all laid out, start with the click button and the counter.
kalayamosu kalayamosu

2015/10/30

#
I dont have any idear on how I can do it... I need a code to help me out.
lordhershey lordhershey

2015/10/31

#
If I can, maybe i can start a bit. This post has given me a few ideas. The game reminds me of cookie clicker, but there are scenarios on this site you can download and look at. You actually do have an idea if you look at your original post. Start with the first thing , make an actor called button - in the act method have it get the number of mouse clicks and it keep that number in a variable, display this variable to the console window using something simple like System.out.println("Number of Clicks " + NumberOfClicks); build it up from there. Take on of the default graphics to be the actor, use mouse info to get the clicks in the act method. NumberOfClicks is an integer that is defined in your class.
davmac davmac

2015/10/31

#
If you're still stuck, read this page, especially the section titled "I don't know where to start!"
You need to login to post a reply.