face drawing not visible second eye
Blitz3D Forums/Blitz3D Programming/face drawing not visible second eye
| ||
ka=666 Graphics ka,ka,0,2 AppTitle "arc, " Color 255,255,0 Oval 1,1,ka,ka,1 Color 255,0,0 Oval ka/4,ka/4,ka/6,ka/6,1 Color 255,0,0 Oval Int(ka*(3/4)),ka/4,k/6,k/6,1 WaitKey |
| ||
3/4 gets computed as '0' by that code...you need to specify them as floating point numbers, 3.0/4.0, and use float(ka). A flip statement couldn't hurt either, along with a setbuffer backbuffer() |
| ||
Remember that if you don't explicitly tell the program to make a variable a floating point number (that supports decimal places), variables will be treated as integers (whole numbers). All integers divisions are effectively 'rounded down', and as Matty said, 3/4 would come out to 0 (0.75 is rounded down to 0). |
| ||
Actually a better term would be "cut down" (EDIT: Or "rounded down" indeed), because if it were really rounded, 0.75 would turn to 1, wouldn't it?. Int() rounds the float into the closest integer. "3.8536" converted to Int is "4". "3.1437" converted to Int is "3". |
| ||
Also, in this line: Oval Int(ka*(3/4)),ka/4,k/6,k/6,1 You are using 'k' instead of 'ka'. |
| ||
In blitz int rounds to the nearest integer (unlike other languages where it does indeed just remove anything after the decimal point) you need to use floor or ceil in blitz to enforce rounding up/down. Its something that you should keep in mind as it can catch you out otherwise. |
| ||
Using the Int() command 'rounds' a floating point number. Integer divisions are "cut down" (good description Kryzon). |