Saving

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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Saving

Post by Robin »

Heh, yeah. Luckily not everyone gives up that easily. ;)
Help us help you: attach a .love.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Saving

Post 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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Saving

Post 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
Help us help you: attach a .love.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Saving

Post 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
Attachments
SaveLoad.love
0.7.0
(934 Bytes) Downloaded 87 times
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests