Page 1 of 1

HELP NEEDED: Random Map Loader

Posted: Mon Jan 21, 2013 2:50 am
by CrazyCallum113
Okay, so I've been figuring how to do a map system in my game for a while now, so; I came up with an idea but I'm not all that sure on how to do it...

So my thought is that as you enter a new area or "stage", a map is randomly selected and therefore loaded. Now how I thought you would do this is by running a random number generator from... lets say 0-150. Then it would load a script with a map under that number. So for example if it outputted 113, it would load map113.lua

How would I do this?
Thanks in advance!!

Re: HELP NEEDED: Random Map Loader

Posted: Mon Jan 21, 2013 3:18 am
by NightKawata
If you just want to load a .lua file at random, then try this:

Try me! One size fits all! (Horrible puns I know)

Re: HELP NEEDED: Random Map Loader

Posted: Mon Jan 21, 2013 3:49 am
by ejmr
If you need to execute the script for the map then do everything from NightKawata's example and then call map() sometime after calling love.filesystem.load(), which only loads a script but leaves you to execute it on your own.