Page 1 of 1

using file as world data

Posted: Sat Jun 13, 2015 12:53 pm
by MattyAB
Hey Everyone,

So I've recently started making a new game (check my post about it here: viewtopic.php?f=5&t=80361)
Here is the GitHub Repo: https://github.com/tom7tomm/SuperDodger. And want to add in the blocks to be dodging. I want to have multiple formations of blocks to have the game randomly choose from, and want to have these stored in some kind of external file. I have looked around and found the love.filesystem.read but am not sure how to use this information and put it into my game. How do I do this? I want the file just to tell the game where to put the blocks to dodge.

Thanks!

Re: using file as world data

Posted: Sat Jun 13, 2015 2:42 pm
by veethree
You could use a lua file containing a table with the formations, then just require it.

Re: using file as world data

Posted: Sat Jun 13, 2015 3:16 pm
by MattyAB
I meant a file such as an xml, but I'll give that a try.

Thanks!

Re: using file as world data

Posted: Sat Jun 13, 2015 6:33 pm
by zorg
MattyAB wrote:I meant a file such as an xml, but I'll give that a try.
why not just use lua? it is a scripting language, and less verbose than xml anyway :3

Re: using file as world data

Posted: Sun Jun 14, 2015 7:06 am
by MattyAB
Ok, So I've got the code for the table, as well as the table that *should* be drawing the blocks. I will attach a .love file so that you can take a look. So why is this mechanism not working? I only want it drawing the block if it's set to true in the worldData.spawn() call. Also, how would I be able to have it moving across the screen as well as making more at the same time? is there some way I can add it to some kind of buffer or something, and then it keeps the block drawn as long as it is on the screen. How would I go about doing this?

Thanks!

Re: using file as world data

Posted: Mon Jun 15, 2015 6:35 pm
by MattyAB
Any ideas Guys?