Author Topic: Asteroid radius increase after it's creation  (Read 1221 times)

0 Members and 1 Guest are viewing this topic.

Orion63

• Sapling
• Thank You
• -Given: 0
• Posts: 73
• We are the Knights who say... NI!
Asteroid radius increase after it's creation
« on: August 17, 2011, 07:15:41 PM »

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)endfunction 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?

Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
Re: Asteroid radius increase after it's creation
« Reply #1 on: August 17, 2011, 08:26:31 PM »
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

Orion63

• Sapling
• Thank You
• -Given: 0
• Posts: 73
• We are the Knights who say... NI!
Re: Asteroid radius increase after it's creation
« Reply #2 on: August 17, 2011, 08:42:52 PM »
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

annikk.exe

• Achiever
• Ent
• Thank You
• -Given: 0
• Posts: 1,794
Re: Asteroid radius increase after it's creation
« Reply #3 on: August 18, 2011, 07:59:55 AM »
Problem:

Code: [Select]
`function LevelLogic() print(roid.Radius) coroutine.yield()end`

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

Pilchard123

• Tester
• Old Oak
• Thank You
• -Given: 0
• Posts: 899
• Eufloria: Yes
Re: Asteroid radius increase after it's creation
« Reply #4 on: August 18, 2011, 10:42:58 AM »
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

Orion63

• Sapling
• Thank You
• -Given: 0
• Posts: 73
• We are the Knights who say... NI!
Re: Asteroid radius increase after it's creation
« Reply #5 on: August 18, 2011, 02: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 ^^

Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
Re: Asteroid radius increase after it's creation
« Reply #6 on: August 18, 2011, 03:58:39 PM »
How much does it change BTW?

Orion63

• Sapling
• Thank You
• -Given: 0
• Posts: 73
• We are the Knights who say... NI!
Re: Asteroid radius increase after it's creation
« Reply #7 on: August 18, 2011, 04:13:55 PM »
...

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

...

Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
Re: Asteroid radius increase after it's creation
« Reply #8 on: August 18, 2011, 04:20:09 PM »
Ohh, didn't read it

Pilchard123

• Tester
• Old Oak
• Thank You
• -Given: 0
• Posts: 899
• Eufloria: Yes
Re: Asteroid radius increase after it's creation
« Reply #9 on: August 18, 2011, 04:39:27 PM »
You could add the trees in LevelLogic() too, just don't use the PlantTree() or whatever it's called.

Orion63

• Sapling
• Thank You
• -Given: 0
• Posts: 73
• We are the Knights who say... NI!
Re: Asteroid radius increase after it's creation
« Reply #10 on: August 18, 2011, 04:51:22 PM »
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

annikk.exe

• Achiever
• Ent
• Thank You
• -Given: 0
• Posts: 1,794
Re: Asteroid radius increase after it's creation
« Reply #11 on: August 19, 2011, 07:49:17 AM »
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.  :>

• Tester
• Old Oak
• Thank You
• -Given: 0