| View previous topic :: View next topic |
| Author |
Message |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Sun Dec 04, 2005 10:00 am Post subject: Stopping functions |
|
|
In my quest to make me game, i have added a menu, and some levels. the problem lies with the menu still being active(i can see it in the background) when i load a level. I am currently using something like this | Code: | if level==1 then
dofile("level1.lua")
elseif level==2 then
dofile("level2.lua")
...etc.
end |
when i select my level, it loads the level fine but from a wallpaper error you can see my menu still going on in the background. my concern is that this will make my game slow down. what function should i use instead of "dofile"? or what function should i use to cease the menu from opperating? |
|
| Back to top |
|
 |
Bob535
Joined: 04 Nov 2005 Posts: 56
|
Posted: Mon Dec 05, 2005 3:59 am Post subject: |
|
|
| When you run another file, just use a break on the first file to terminate the process. I think it works, and that is what I do. |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Mon Dec 05, 2005 4:45 am Post subject: |
|
|
| I tried that but all it did was create the menu to be flashing in the background. |
|
| Back to top |
|
 |
JoshDB

Joined: 05 Oct 2005 Posts: 87
|
Posted: Mon Dec 05, 2005 7:13 am Post subject: |
|
|
If you call your menu from inside "level1.lua" etc. then just appropriate a variable like [menushow = true/false], then say
| Code: | if menushow == true then
dofile("menu.lua")
end |
|
|
| Back to top |
|
 |
|