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

2014/1/18

Need help with adding boosters and point system

UNDEAD_DC UNDEAD_DC

2014/1/18

#
Hi i have made this: http://www.greenfoot.org/scenarios/10596 and now i want to add a point system that adds one point when you: catch a container avoid getting hit by a red container when you catch a coin booster it has to add 2 points then i want the dropspeed of the containers go up with 1 every 5 points you get the points you get from coinboosters dont make u go faster so you must catch 5 containers to get a higher level but when you got 5 coins in a row you wont level coin speed stays same even when you reach lets say 50 points so speed lvl 10 the coins still fall as fast as in the beginning. when you catch a red container i want the player loose 1 hp and 1 point same for missing a white one. catching or not catching the coinbooster does not add or remove life missing doesnt add point the pointbooster will just disapear hope you get what i want and please someone help me the points you have when you get out of lives need to get saved so when you played all lvls (this is one out of 4 lvls of a game) you get a total of points you got in the game
danpost danpost

2014/1/18

#
Add what field(s) you might need; add some coding to control the value of the field(s) using the condition you supplied above. You will probably need two int fields in your world class (or in the class of the actor object that represents the flatbed of the truck). One for the totalScore and one for the counter of containers caught that resets at 5 while increasing the dropSpeed of the containers. The Container7 class will need two int fields for the speed. One will be for the speed itself; the other for the current y-location multiplied by a factor. I suggest using a number around 5 as the factor. value for speed and using one-fifth of its value for the actual speed (or 4 and 1/4, etc). You would add the factor to the your y-location field (which holds a value of the actual y-location times the factor you use) each act cycle and use the resulting value divided by the initial factor to set the location of the container.
Act  Y-fld Y-actual
0    0    0
1    5    1
2   10   2
3   15   3
4   20   4
5   25   5
6   30   6
...
// increased factor; but no increased division
0    0    0
1    6    1
2   12   2
3   18   3
4   24   4
5   30   6 // note increase here
...
// more increased
0    0    0
1    8    1
2   16    3
3   24    4
4   32    6
See what you can do. I will need to return later.
You need to login to post a reply.