# How do I convert a float to a int?

Get help using Construct 2

### » Fri Sep 23, 2016 8:57 pm

Hello friends, i'm making a game that gets a score by the max height the player can reach, but the value of player.y is everytime a float like "108.108846150" and this is poor for the design. So how do I convert this float value "108.108846150" to a simple int "108"? Any ideas?
B
12
S
4
G
5
Posts: 9
Reputation: 3,348

### » Fri Sep 23, 2016 9:09 pm

Set ScoreValue to int(player.y)

Alternately floor(player.y), ceil(player.y), or round(player.y)
B
59
S
29
G
120
Posts: 1,787
Reputation: 67,974

### » Fri Sep 23, 2016 9:19 pm

That's exactly what I wanted, thank you!
B
12
S
4
G
5
Posts: 9
Reputation: 3,348

### » Sat Sep 24, 2016 5:58 am

Just a thing to tell you that int will alway make the number positive so if you want negative number you will have to use alternative way
B
52
S
24
G
6
Posts: 391
Reputation: 7,855

### » Sat Sep 24, 2016 6:39 am

int() works for negative numbers.

int(3.14) = 3
int(-3.14) = -4
B
97
S
36
G
131
Posts: 5,514
Reputation: 83,466