Eufloria > Eufloria Classic Mods
What are you working on? :D
Aino:
Annikk's tutorials doesn't work anymore :(
The pictures are unavailable, at least to me...
What to do?
Lost Seedling:
It's been that way for some time now. Fortunately the pictures were not that important. Aino, YOU certainly don't need those guides anymore!
I've been working on a new map and have a question for you though:
In reference to the CameraZoom functions, Alex wrote:
--- Quote ---GetCameraZoom() float Gets the camera zoom - warning this value is different from the value passed in from SetCameraZoom for arcane and ridiculous reasons... the formula is (0.05f + ((float)(Zoom * Zoom * Math.Sign(Zoom)) / 10)) where Zoom is the value you passed in
--- End quote ---
http://www.euflorium.com/index.php?topic=212.msg1862#msg1862
Can you explain that gobbledygook? I'd like to know if I say "GetCameraZoom()" and the value returned is 12.345, then how do I calculate what value to enter into "SetCameraZoom()" in order to achieve the same zoom factor? In some of your maps you converted the desired map-dimensions into a Zoom scale in order to show the whole map, but I want to convert the GetCameraZoom value directly into a SetCameraZoom value. I've had no luck deciphering Alex's explanation.
Aino:
It's not about me needing the tutorials, it's for people who want to make their own maps :)
As for the formula: (0.05f + ((float)(Zoom * Zoom * Math.Sign(Zoom)) / 10))
Let's say you paste in the value 12.345 into the SetCameraZoom() function, then the output from GetCameraZoom() would be (0.05 + (12.345 * 12.345 * 1) / 10), which is 15.28...
Then you just "simply" reverse the formula, and voila you have the value you should put into SetCameraZoom() to get the value you want from GetCameraZoom() :)
The Math.Sign() takes the sign(minus or plus) from the number and you can use it to multiply so that you get that sign, in this case we are dealing with a squared number, which means you need to put the sign back in again somehow. The formula seems to be used in a logarithm of some sorts if you're dealing with negative numbers for a zoom value...
Hope I was of some help to you :)
Lost Seedling:
So the answer is SetCameraZoom(X) = math.sqrt((GetCameraZoom()-.05)*10).
That works perfectly and since I don't think you can have a negative value for zoom no sign conversion is necessary. I couldn't figure out what the "f", "float" and "Math.Sign" were or how they were determined or used. Thanks a lot!
Aino:
Float is one of the datatypes you can use for variables in most programming languages. Lua itself runs decimal numbers on floats or doubles. A float is a floating point decimal number, which simply mean it's a number with a comma. The "f" is to make any number connected to it a float, while the (float) casts any number coming after it to a float. This is very useful, because floats are 32 bit, while doubles are 64 bit, which means you cut the memory space used in half by using floats :)
Glad you got the function sorted out, and maybe you'd like to start on some c# coding or perhaps Java, it seems you enjoy making all of these maps, why not try to make something of your own? :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version