General discussion about LÖVE, Lua, game development, puns, and unicorns.
molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

Ok, my platform game is on its way. Currently I've managed to have an animated character with basic movement (walking and jumping) in a tiled background plus a five layer parallax scroll. I'm detecting collision to the ground in a very primitive way, and my next step is to properly detect ground and walls (once I get to this I'd like to share with you what I'm into, although it's on a very early stage).

At first I was planning to use löve2d's physics module, but I've been told to use the hardOnCollider instead, and I've some doubts: does it process gravity for all the characters in the game (as love.physics has its "world" and "body" objects), or should I implement it for each character?

On the other hand, the friend that told me about Löve2D told me yesterday that he thinks it should be possible to reload all the lua files while running the program. Is it really possible? It would be really convenient indeed.

Also it would be nice having a "console inside" while running the game, so you can change any variable to debug faster. Is it possible as well?

nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Questions about platform game development

molul wrote:On the other hand, the friend that told me about Löve2D told me yesterday that he thinks it should be possible to reload all the lua files while running the program. Is it really possible? It would be really convenient indeed.
Not sure if I understand what you mean, but if you change the reference to nil, the garbage collector will take care of unloading stuff. To load a file, you just use require.
molul wrote:Also it would be nice having a "console inside" while running the game, so you can change any variable to debug faster. Is it possible as well?
You can use debug.debug(), if you launch the game from a terminal. Example (the code may not be entirely correct, as I haven't written any lua for 6 months):

Code: Select all

function love.keyboard(key)
if (key=='rctrl') then
debug.debug()
end
end

bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Questions about platform game development

nevon wrote:

Code: Select all

function love.keypressed(key)
if key == 'rctrl' then
debug.debug()
end
end
FIFY

molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

Re: Questions about platform game development

Thanks for the debug thing I'll try it.
nevon wrote:
molul wrote:On the other hand, the friend that told me about Löve2D told me yesterday that he thinks it should be possible to reload all the lua files while running the program. Is it really possible? It would be really convenient indeed.
Not sure if I understand what you mean, but if you change the reference to nil, the garbage collector will take care of unloading stuff. To load a file, you just use require.
Yes sorry, I didn't ellaborate much. This is, ideally, what I'd like to do:

-I run my game.
-With the game running, I change the code.
-Back in the game window, I press a key and then the game is reset with the new code.

nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Questions about platform game development

molul wrote:Thanks for the debug thing I'll try it.
nevon wrote:
molul wrote:On the other hand, the friend that told me about Löve2D told me yesterday that he thinks it should be possible to reload all the lua files while running the program. Is it really possible? It would be really convenient indeed.
Not sure if I understand what you mean, but if you change the reference to nil, the garbage collector will take care of unloading stuff. To load a file, you just use require.
Yes sorry, I didn't ellaborate much. This is, ideally, what I'd like to do:

-I run my game.
-With the game running, I change the code.
-Back in the game window, I press a key and then the game is reset with the new code.
If you're intializing the game properly in love.load, you could just bind that to a key.

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Questions about platform game development

If your libraries are written right, something like this should work:

Code: Select all

function love.keypressed(key)
if key == 'f5' then
end
end
You can also use "require", but then you must remember to set package.loaded[modulename] to nil.

The most complete answer is: it depends.

molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

Re: Questions about platform game development

Thanks Robin, that worked perfectly. I love this community The debug thing I'll try it later, as currently I don't have my project set up to be run from terminal.

tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Questions about platform game development

Its actually not that hard to write a mini command prompt inside your game, using loadstring()(). The hardest part is adding miscellaneous little features, like previous command.
Kurosuke needs beta testers

molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

Re: Questions about platform game development

Interesting. I'll try to implement it in the future. For now I want to get into HardOnCollider.

By the way, tentus, I remember you told me to use it instead of love.physics module. Could you please tell me some good reasons (mostly to tell my partners)? RIght now I know very few of both, and I'd like to have some information before I choose one or the other. Thanks beforehand!

bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Questions about platform game development

Well, love.physics is more suited for realistic physics, which is generally what platform games don't want to have. (A common complaint is it all feeling to "floaty".)

Who is online

Users browsing this forum: No registered users and 16 guests