Permalink
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Roguelike/saveAndLoad.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
And when saving, it only saves the player's (x,y) coordinates, health, attack and xp; it does not save the map. Save by pressing P.
17 lines (16 sloc)
321 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
void saveGame(int x, int y, int health, int attack, int xp){ | |
ofstream f("latestSaveFile.txt"); | |
f << x; | |
f << "."; | |
f << y; | |
f << "."; | |
f << health; | |
f << "."; | |
f << attack; | |
f << "."; | |
f << xp; | |
f.close(); | |
} |