How do I Remove Decimals

Just started using Construct 2? Post your questions here

Post » Sun Aug 16, 2015 2:33 am

I don't exactly know how to phrase my problem. My problem is: I'm trying to make a golf game and to make it I want power, and to make it slightly more difficult I randomly choose a number 1-10 every 0.2 seconds for the power, and when you click it moves a certain distance based on the power, but I can't display the number because it's being set to numbers with decimals like 1.4330501577351242 or 9.736560676712543. I tried setting the option to 1-1.99999999999999 or 9-9.999999999999 but it doesn't work. Can anybody help?
B
5
Posts: 18
Reputation: 269

Post » Sun Aug 16, 2015 8:32 am

Make sure to read the manual carefully, especially the System Expressions section regarding numbers.

The parts that should be of interest to you are such things as Int and Round (especially Round for your case), although you may then decide to try Floor or Ceiling.

Have a look and get back to us if you still have a problem.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
132
S
29
G
81
Posts: 5,328
Reputation: 56,655

Post » Sun Aug 16, 2015 1:52 pm

Message: Superpigy is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
zenox98 wrote:Make sure to read the manual carefully, especially the section regarding numbers.

The parts that should be of interest to you are such things as Int and Round (especially Round for your case), although you may then decide to try Floor or Ceiling.

Have a look and get back to us if you still have a problem.


Round seems very useful but how do you use it for a variable?
B
5
Posts: 18
Reputation: 269

Post » Sun Aug 16, 2015 2:04 pm

Every 0.2 seconds -> Set variable to: round(random(1,10))
B
32
S
7
G
4
Posts: 397
Reputation: 4,589

Post » Sun Aug 16, 2015 2:32 pm

grigrizljac wrote:Every 0.2 seconds -> Set variable to: round(random(1,10))


Thank you so much!
B
5
Posts: 18
Reputation: 269


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests