How come this doesn't work?

Blitz3D Forums/Blitz3D Beginners Area/How come this doesn't work?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi there.

Try this:
Graphics 640,480,32,2

yScreen=768
Global radydistance=(yScreen * (578.0/768))

Print radydistance
WaitKey()

Your calculation was returning 0 because you were trying to do float division with integers.
Someone else can probably explain this better than me, but if you are calculating a float, you need to use floats in your division.
Which is why the code above has 578.0 instead of 578.

[EDIT] Rob - your post appeared literally 8 seconds before mine.