Hello,
I started recently with HaxeFlixel, for my project I need a simple highscore implementation. I got this to work on my pc, but when I try to run a debug or release on my android mobile it doesn't work.
Im using in the menustate create function:
highSave = new FlxSave();
highSave.bind("Highscore");
var tempScore : Int;
if (highSave.data.scoreArray == null){
tempScore = 0;
} else {
tempScore = highSave.data.scoreArray[0];
}
scoreText = new FlxText(100, 100, 500, "HighScore: " + tempScore, 30);
scoreText.color = (0x0B3B17);
add(scoreText);
then in the playstate when the this state is finished and is supposed to return to menustate I use:
if (MenuState.highSave.data.scoreArray != null && score > MenuState.highSave.data.tempHigh[0]) {
MenuState.highSave.data.scoreArray = new Array<Int>();
MenuState.highSave.data.scoreArray.push(score);
//MenuState.highSave.flush();
MenuState.highSave.close();
}
FlxG.switchState(new MenuState());
As mentioned earlier this works on my pc, but on my android it keeps always showing "HighScore: 0".
I suspect it has to do with internal storage permissions, I added permissions to write and read on external storage in the project.xml and it also shows that the app has those permissions. I have tried to move the app to the external storage but this is not supported on my phone. And I see no files being created on external storage.
I hope someone can help me fix this problem.