Some math problems

Get help using Construct 2

Post » Mon Mar 12, 2012 3:16 pm

Ive come across a math problem with the xp in my game. I have two variables: XP and XP_MAX. When the players XP is equal or greater he gains a level and the XP is set to what was left after leveling. Now for the problem:

when a level is gained the value for XP_MAX is increased like this: Self.XP_MAX * 1.2 Soon the value will get lots of decimals and I wonder if there is a way to round off that or some parameters to put in so the value cant get into decimals?

Will keep trying but would appreciate any input :)

Thanx
B
21
S
7
G
4
Posts: 221
Reputation: 5,070

Post » Mon Mar 12, 2012 3:28 pm

you can use the function "floor" to round the result.

floor(Self.XP_MAX * 1.2)
B
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Mon Mar 12, 2012 3:34 pm

Thank you!! Wish I had a complete list of functions, not many mentioned in the manual.
B
21
S
7
G
4
Posts: 221
Reputation: 5,070

Post » Mon Mar 12, 2012 3:37 pm

not?

http://www.scirra.com/manual/126/system-expressions

Scroll down to "math" :)
B
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Mon Mar 12, 2012 3:41 pm

Will do :) thx again
B
21
S
7
G
4
Posts: 221
Reputation: 5,070


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests