Eufloria > Eufloria Classic Support
Problem with function LevelDraw()
(1/1)
annikk.exe:
Hello,
When I declare a variable in my function LevelDraw(), and run the level, it works fine.
But then, if I quit and reload the level, all the variables that were learned from the previous time I played are still there!
This is a problem because it stops new things being procedurally generated. When the level loads, I want to say "if init == nil then" run a whole bunch of math.randoms to procedurally generate stuff, as well as setting "init" to = 1. That way the code should only be run once. But when I do this inside a LevelDraw, it remembers the values of all variables between plays. :/
This is hard problem to explain.. :P
Pilchard123:
Stick something like
if (Quit(true) or Quit(false)) then
init = nil
end
in your LevelLogic. That code probably won't work, but I hope it explains what I mean. Basically, check if the level is quit, then reset init.
Alex:
Currently unsure if just putting "all your variables = nil" at the end of your level logic function will work (execution may be interrupted after a call to Quit()) but if so then in future I will add LevelShutdown
annikk.exe:
I found a workaround to this. Somewhat obvious, but basically I just declare all my variables in LevelSetup instead. That works fine, so no need to worry about this really..
Navigation
[0] Message Index
Go to full version