Saving[Please helpDD:]
Posted: Tue Jan 24, 2012 5:03 am
I have no clue how to save the players wave, health, and what weapons are unlocked(x_unlocked = true(x = "pistol""shotgun"etc.."). If someone could help me with it I'd really appreciate it.
EDIT:
So I'm now starting to attempt implementing saving into my game. And the first thing I noticed is, that if I update my game, then the save file will change too. So is there a way I can put the save file somewhere else out of the game, and then load it from there?(If so, where should I put it? Because the only obstacle that I'm seeing is if someones on a mac, and I save it lets say, in application support, then it probably wouldn't save on a windows or linuxr, because the file path is probably completely different)
also, is there a way that I can clear the save file?
I have these lines of code..
but I noticed that the first save was the only save that took effect. I'm guessing that's because it was just writing something like..
because I never cleared the file, I just added on to it.
So is there a way to clear the file?(not delete the file itself. Just everything inside of it.)
EDIT:
So I'm now starting to attempt implementing saving into my game. And the first thing I noticed is, that if I update my game, then the save file will change too. So is there a way I can put the save file somewhere else out of the game, and then load it from there?(If so, where should I put it? Because the only obstacle that I'm seeing is if someones on a mac, and I save it lets say, in application support, then it probably wouldn't save on a windows or linuxr, because the file path is probably completely different)
also, is there a way that I can clear the save file?
I have these lines of code..
Code: Select all
if key == "l" then
if love.filesystem.isFile("save.lua") then
love.filesystem.load("save.lua")()
end
end
if key == "o" then
if love.filesystem.isFile("save.lua") then
save:open('w')
save:write("steve.x = "..steve.x)
save:close()
else
save = love.filesystem.newFile('save.lua')
save:open('w')
save:write("steve.x = "..steve.x.." camera.x = "..camera.x)
save:close()
end
end
Code: Select all
steve.x = 5 steve.x = 16 steve.x = 60
So is there a way to clear the file?(not delete the file itself. Just everything inside of it.)