using file as world data

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
User avatar
MattyAB
Citizen
Posts: 57
Joined: Wed Mar 25, 2015 8:37 pm

using file as world data

Post 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!
Check out my blog - The place to find out about the latest tech news! http://thegeekcircle.blogspot.co.uk/
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: using file as world data

Post by veethree »

You could use a lua file containing a table with the formations, then just require it.
User avatar
MattyAB
Citizen
Posts: 57
Joined: Wed Mar 25, 2015 8:37 pm

Re: using file as world data

Post by MattyAB »

I meant a file such as an xml, but I'll give that a try.

Thanks!
Check out my blog - The place to find out about the latest tech news! http://thegeekcircle.blogspot.co.uk/
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: using file as world data

Post 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
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
MattyAB
Citizen
Posts: 57
Joined: Wed Mar 25, 2015 8:37 pm

Re: using file as world data

Post 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!
Attachments
game.love
(80.1 KiB) Downloaded 346 times
Check out my blog - The place to find out about the latest tech news! http://thegeekcircle.blogspot.co.uk/
User avatar
MattyAB
Citizen
Posts: 57
Joined: Wed Mar 25, 2015 8:37 pm

Re: using file as world data

Post by MattyAB »

Any ideas Guys?
Check out my blog - The place to find out about the latest tech news! http://thegeekcircle.blogspot.co.uk/
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 10 guests