Page 2 of 2

Re: Saving

Posted: Tue Nov 09, 2010 4:44 pm
by Robin
Heh, yeah. Luckily not everyone gives up that easily. ;)

Re: Saving

Posted: Thu Nov 18, 2010 12:59 am
by Jasoco
By the way, don't put the save call in Update. Put it in KeyPress. Else it will be calling the save function every frame. That's what KeyPress is for.

*Disclaimer: I haven't Löved in a while so I forgot what the function for KeyPress was called so it's probably something else.

Re: Saving

Posted: Thu Nov 18, 2010 4:33 pm
by Robin
Jasoco wrote:By the way, don't put the save call in Update. Put it in KeyPress. Else it will be calling the save function every frame. That's what KeyPress is for.
Yeah, you're right. It would probably best be something like:

Code: Select all

love.keypressed(key)
    if key == 's' and (love.keyboard.isDown 'lctrl' or love.keyboard.isDown 'rctrl') then
        -- save code here
    end
end

Re: Saving

Posted: Thu Nov 18, 2010 4:42 pm
by TechnoCat
Yes another way, if on 0.7.0, is to put it in love.quit().

Code: Select all

function love.quit()
  --Before quitting, save the new information to the savefile.
end