Can someone see what I'm doing wrong/not seeing here?? Because I cant!!!!
in
Programming Questions
•
1 month ago
OK so let me explain what it is first. This is just one line that determines the y position of a rect. So it is getting a time value from the timeArray in the form: 15.45, it then determines how long between that time and the current time. It is then scaled so that for every hour there is 100px. So, for example if there is a 2 hour difference the value should be 200.
In the comment it is broken down and explained, what am i doing wrong?
I println'd the value and it is giving me -1100 haha. What am i doing wrong?
- float x = ((((int(endTimeArray[eventNumberInArray])+(((endTimeArray[eventNumberInArray]-int(endTimeArray[eventNumberInArray]))*pow(10,2))/60))-(hour()+(minute()/60)))*60)/60)*100);
- /*
- a = endTimeArray[eventNumberInArray]-int(endTimeArray[eventNumberInArray])
- Takes the time from the array (e.g. 12.15) and minuses the integer of it so: 12.15-12 and were left with 0.15.
- b = a *pow(10,2)
- Now we make .15 into the minutes by multiplying by 100: 0.15*100 = 15.
- c = b/60
- Divide by 60 so that we make it into a real decimal rather than the amount of minutes so: 15/60 = 0.25 hours.
- f = int(endTimeArray[eventNumberInArray])+c
- This makes it into the amount of hours so it is now 12.25 hours.
- d = minute()/60
- to make the minutes into a decimal. For example 30 --> .5
- e = hour()+d
- Now hour is added to the decimal of a minute so for example: 11.5 hours.
- g = f-e
- Using previous examples: 12.25-11.5 = 0.75. Its a 0.75 Hour difference
- h = e*60
- Multiply 0.75*60 so that it goes back into minutes. 0.75*60 = 45
- i = h*100/60
- Now it is scaled so that every hour is equal to 100. 45*100/60 = 75.
- */