0
Monster game
i want it so for line 8. every time you get +25 points you get +2 points. I dont know rlly how to put that into code though. https://code.sololearn.com/WwwvFnUBQ688/?ref=app
10 Answers
+ 3
I think with an if statement and modulus, you could do it. Something like
if(points % 25 = 0)
points += 2
+ 2
Ausgrindtube "=="
+ 1
Do you mean, say the player earns 1 point until 25 and then earns 2 points (27, 29, 31...) until he's at 50 (51) and then 4 points (55, 59, 63...) until he's at either 75 or 100?
+ 1
Thanks, got it. As I said, you'd be better off creating a bonus points variable and adding it to the regular points. You could divide the total points by 25 and then multiply it by 2. You'll get that total.
0
Ausgrindtube it only does it once. i want it so it stays += 2 points until it reaches 50 which is when i want the points to be += 4
0
i want the player to earn 2 points every 25 points. until the âmonsterâ has 0 health
0
It could be the wine, lack or sleep or just genuine thickness on my behalf. I don't know that I quite understand what you want. Can you write out a little example, a bit like what I've done above?
I have an idea that if you want the, let's call it "points bonus", to increase by 2 every 25 points. You'd need to create a new variable, say bonusP and start it out as 0. When the player reaches 25 points update bonusP to 1 and make a player points total equal the sum of their regular points and the bonusP. When they reach the next milestone, you update bonusP accordingly and so on.
To check the milestone, you could do something like my if statement right at the beginning.
0
okay so.
0 points - 24 = 1 point
25 - 49 = 2 points
50 - 74 = 4 points
75 - 99 = 6 points
get it?
0
Ausgrindtube wdym by update bonusP to 1 and make the playet total equal the of there regular points and the bonusP
0
Do you realise that there is an impossibility with this table?
0 points - 24 = 1 point
25 - 49 = 2 points
50 - 74 = 4 points
75 - 99 = 6 points
If one is adding an even amount of points to an odd number, you can't get back to the even number (49 will skip to 51 and then add 4).
Otherwise, I think I have an example for you.
https://code.sololearn.com/WmW291DVWMP8/?ref=app