Structure tutorial?

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
Gnx
Prole
Posts: 40
Joined: Sun Nov 09, 2008 6:38 am

Structure tutorial?

Post by Gnx »

One thing that would be very handy for a newcomer like me (= not new to programming, but new to game progamming),
would be a little concept level tutorial on where and how to do things like levels, powerups and for example story screens etc. also when to put things in the same file and when to use separate .lua files.

My first game mechanic didn't long to code, but right now I have everything in the main.lua file and its not going to be very flexible or manageable if I progress it any further in its current state.

So if someone has some good modular structure ideas that could be implemented in Löve, I'd be very grateful :)
Chman
Prole
Posts: 4
Joined: Sun Nov 09, 2008 7:16 pm

Re: Structure tutorial?

Post by Chman »

Hi,

First of all, you'll find answer to half of your questions in Lua's official doc (using separate .lua files and so on). It's a good place to start.

About game programming and stuff like levels, menu screens and such, you could use a state based structure, each level and type of screen (menu, credits...) being a state. That's what I'm used to work with and it works well. Define each state and update/render the one you need in your render loop. Each state could be stored in a class with a custom update/draw method.

Sorry, I don't have code examples right here but I guess you won't have any trouble to implement this kind of mechanism if you're not new to programming.

Hope this helps,

Tom
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 93 guests