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
28
S
10
G
6
Posts: 251
Reputation: 6,655

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
44
S
10
G
7
Posts: 437
Reputation: 5,963

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
28
S
10
G
6
Posts: 251
Reputation: 6,655

Post » Mon Mar 12, 2012 3:37 pm

not?

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

Scroll down to "math" :)
B
44
S
10
G
7
Posts: 437
Reputation: 5,963

Post » Mon Mar 12, 2012 3:41 pm

Will do :) thx again
B
28
S
10
G
6
Posts: 251
Reputation: 6,655


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, dokthor, ilyaTyl, Yahoo [Bot] and 10 guests