Euflorium: The Eufloria Community

Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: Orion63 on August 18, 2011, 03:15:41 AM

Title: Asteroid radius increase after it's creation
Post by: Orion63 on August 18, 2011, 03:15:41 AM


Code: [Select]
function LevelSetup()

-- Global Values
Globals.G.Asteroids=(0)
SetBackdropColor(18, 0, 0)

roid = AddAsteroid(0, 0)
roid.Owner = 0
roid:SetRadius(50)
roid.Moveable = false

print(roid.Radius)
end


function LevelLogic()

print(roid.Radius)
coroutine.yield()
end
Code above should create a 50radius asteroid, but after LevelSetup it's radius increases to ~245.

Any reason and/or fix for the radius increase after level setup?
Title: Re: Asteroid radius increase after it's creation
Post by: Aino on August 18, 2011, 04:26:31 AM
Use .Radius = 50

Or atleast I do and never got any problems... And keep in mind that 50 is a very small number, so the game might change it for visability sake :)
Title: Re: Asteroid radius increase after it's creation
Post by: Orion63 on August 18, 2011, 04:42:52 AM
Nope, still doesn't work.

The thing is, that the zoom level is pretty small, and you at radius 50, it can be seen clearly

Funny thing is that if owner = 1, radius stays 50.

Thanks, anyway ;)
Title: Re: Asteroid radius increase after it's creation
Post by: annikk.exe on August 18, 2011, 03:59:55 PM
Problem:

Code: [Select]
function LevelLogic()

print(roid.Radius)
coroutine.yield()
end


You have a coroutine.yield(), but no While loop!
Title: Re: Asteroid radius increase after it's creation
Post by: Pilchard123 on August 18, 2011, 06:42:58 PM
It doesn't necessarily have to be in a loop. coroutine.yield() just passes back control to other coroutines, ready to be picked up again. In the case above, it is completely unnecessary, since there is nothing that takes up a lot of time, but in other cases, it could be advisable.

Again, I refer you to http://www.lua.org/pil/9.html
Title: Re: Asteroid radius increase after it's creation
Post by: Orion63 on August 18, 2011, 10:50:13 PM
Problem:

Code: [Select]
function LevelLogic()

print(roid.Radius)
coroutine.yield()
end


You have a coroutine.yield(), but no While loop!

That was actually just a test. Even if I loop it, the outcome it's the same.
And regarding the tip that you gave me on the other topic(Of changing the radius on the LevelLogic function), I did that, but obviously the trees already planted there, stayed where they were initially(making them grow outside of the planet).

Thanks anyway ^^
Title: Re: Asteroid radius increase after it's creation
Post by: Aino on August 18, 2011, 11:58:39 PM
How much does it change BTW?
Title: Re: Asteroid radius increase after it's creation
Post by: Orion63 on August 19, 2011, 12:13:55 AM
...

Code above should create a 50radius asteroid, but after LevelSetup it's radius increases to ~245.

...
Title: Re: Asteroid radius increase after it's creation
Post by: Aino on August 19, 2011, 12:20:09 AM
Ohh, didn't read it ;)
Title: Re: Asteroid radius increase after it's creation
Post by: Pilchard123 on August 19, 2011, 12:39:27 AM
You could add the trees in LevelLogic() too, just don't use the PlantTree() or whatever it's called.
Title: Re: Asteroid radius increase after it's creation
Post by: Orion63 on August 19, 2011, 12:51:22 AM
You could add the trees in LevelLogic() too, just don't use the PlantTree() or whatever it's called.

As the only asteroid not empty, the game plants trees automatically. My luck, huh :P
Title: Re: Asteroid radius increase after it's creation
Post by: annikk.exe on August 19, 2011, 03:49:17 PM
Try adding player trees/seedlings in LevelSetup too.  Then it won't have to auto-add them, which might stop it from screwing everything up.  :>
Title: Re: Asteroid radius increase after it's creation
Post by: Pilchard123 on August 19, 2011, 06:35:09 PM
If it's NOT empty, why does it add trees to it?