HELP NEEDED: Random Map Loader

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
CrazyCallum113
Prole
Posts: 2
Joined: Tue Jan 08, 2013 9:50 pm

HELP NEEDED: Random Map Loader

Post 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!!
User avatar
NightKawata
Party member
Posts: 294
Joined: Tue Jan 01, 2013 9:18 pm
Location: Cyberspace, Room 6502
Contact:

Re: HELP NEEDED: Random Map Loader

Post 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)
"I view Python for game usage about the same as going fishing with a stick of dynamite. It will do the job but it's big, noisy, you'll probably get soaking wet and you've still got to get the damn fish out of the water." -taylor
User avatar
ejmr
Party member
Posts: 302
Joined: Fri Jun 01, 2012 7:45 am
Location: South Carolina, U.S.A.
Contact:

Re: HELP NEEDED: Random Map Loader

Post 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.
ejmr :: Programming and Game-Dev Blog, GitHub
南無妙法蓮華經
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests