Anyone gonna help a newbie?
Anyone gonna help a newbie?
I have been in Lua for a while, but the love modules are still kinda making me scratch my head, but they are easy to learn. What's troubling me is 2 things: I've been observing other game's code to see how complex these games really are, and I noticed there are .lua extensions with code OUTSIDE main.lua. This is really confusing me. How do you use these? Are they subscripts that can be used as basically an organizer? Like to separate different bits so you can edit it more easily? How do you call on them from main.lua? And the other thing is, does anyone have any ideas? If you are the best scripter in the world but have no ideas, then you don't do anything. What's the point in that? I want an idea that wouldn't be too hard to tackle, or too easy. If you need an idea of what I'm capable of,I can do pretty good with syntax, can easily debug issues, but don't know much about love modules, but can check the wiki, but don't want to spend twice as much time on the wiki as on the project. Thanks in advance,
"your actions cause me to infer your ego is the size of three houses" -finley
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Anyone gonna help a newbie?
You don't have to use any files other than main.lua if you don't want to, but it can help keep things organized. I, personally, don't like my scripts getting much longer than two hundred lines - at that point, I group related things together and split it into two files. Additionally, if my game has distinct levels, I tend to put each level's data in its own file. Lastly, many of my projects have a file called helper.lua, which contains extra math functions and other little generic things.
Loading another script can be done in two main ways: Classic Lua style, using a line like require("script"); or with love.filesystem.load. That makes the script execute, which usually creates functions and/or data which can be used by main.lua or yet another script.
As for ideas, it's widely maintained that Love needs a good platformer. Feel free to take on that challenge.
Loading another script can be done in two main ways: Classic Lua style, using a line like require("script"); or with love.filesystem.load. That makes the script execute, which usually creates functions and/or data which can be used by main.lua or yet another script.
As for ideas, it's widely maintained that Love needs a good platformer. Feel free to take on that challenge.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Anyone gonna help a newbie?
I promise I'll get back to work eventually!Taehl wrote: As for ideas, it's widely maintained that Love needs a good platformer. Feel free to take on that challenge.
Kurosuke needs beta testers
- sharpobject
- Prole
- Posts: 44
- Joined: Fri Mar 18, 2011 2:32 pm
- Location: California
Re: Anyone gonna help a newbie?
As Taehl said, you can include external files like this
or like this
I would love to see a good bullet hell game in Love.
Code: Select all
-- in main.lua outside of any function
require("class")
require("queue")
require("globals")
Code: Select all
-- in main.lua
function love.load()
-- love.filesystem.load() returns a function that does the stuff in the file.
-- the "()" at the end of each of these lines is to call that function.
love.filesystem.load("class.lua")()
love.filesystem.load("queue.lua")()
love.filesystem.load("globals.lua")()
-- do other stuff to prepare your game.
end
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Anyone gonna help a newbie?
Note that you probably should use require(). (Less typing for one thing. )
As for what you could do, why don't you try to implement, say, connect-4? It is not a huge project, but you will need to use a large part of the LÖVE API for it.
As for what you could do, why don't you try to implement, say, connect-4? It is not a huge project, but you will need to use a large part of the LÖVE API for it.
Help us help you: attach a .love.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Anyone gonna help a newbie?
You could try to recreate Pentago, a fun little abstract strategy game. It'd get you nice and deep into game development concepts without forcing you to also to a bunch of graphic design.
Kurosuke needs beta testers
Re: Anyone gonna help a newbie?
Even less if you omit the parenthesis:Robin wrote:Note that you probably should use require(). (Less typing for one thing. )
Code: Select all
require 'class' -- equals require( 'class' )
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Anyone gonna help a newbie?
Be careful with that, you can't do anything like this if you omit them:leiradel wrote:Even less if you omit the parenthesis:Robin wrote:Note that you probably should use require(). (Less typing for one thing. )
Code: Select all
require 'class' -- equals require( 'class' )
Code: Select all
require 'something' .. somethingElse
Re: Anyone gonna help a newbie?
Thanks guys! You were a big help! I think I'll try the connect-4 idea...
"your actions cause me to infer your ego is the size of three houses" -finley
Who is online
Users browsing this forum: No registered users and 3 guests