Jump to content

What types of files can Phaser Load and Save?


Recommended Posts

Very new to Phaser and wondering if Phaser can handle loading / saving text files? If not then how are things 'Assets collected', 'Score highs' and 'Levels achieved' saved when returning to a game or always back to Ground zero and start all over again? Couldn't find any reference to text file handling. All loading seems graphics orientated.

I want the user to set a be able to set a series of default colours (x4), to then stored them locally as the New Default Colours for other games and finally load the NEW default colours each time a game is played. Multiple games using these default colours. Is this possible or am I just wanting the impossible? I can do it by getting the User to choose the colours, show RGB, or other, on the screen, user writes them down and then has to manually input the Default Colours for every time a Game is played. Seems a bit awkward and not user friendly.


Link to comment
Share on other sites

12 hours ago, rich said:

Better to use localStorage API for things like this.

Hi Rich,

You are dealing with someone who is computer illiterate in this area. So please correct me if I am wrong. You are saying that there is a simple(?) way to store and load text data within a game while still using Phaser as the Development platform. I am guessing that there is a way of calling the API within Phaser to do this and then load into a matrix or read sections of text. I can cross that bridge when the time comes if I know it is there.

I looked at the Load API and saw 'Loads all external asset types (images, audio, json, xml, txt) and adds them to the Cache. Automatically invoked by a States preload method.'  Couldn't find any way of reading the text file directly. There was a TileMap file load which is text based and suppose this could be used. Likewise couldn't see a 'Save' API to save data as a text file. 

I have been going through the examples and coding and just love the ease, simplicity and power of Phaser so was hoping someone would reply. Thanks.

A question on Sandbox. Where and how does it store files? I love that the main game "Stages" are kept in separate Tabs making it so easy to work with. Was thinking I would have to go to Godot but not now. My skill level as a computer programmer is on the  low side and have always used programming tools presented in a nice self contained box and just plug and play. I'm a senior citizen so get daunted by all the terms you guys just throw about as if everyone knows what you are talking about. :(

Again a very dumb question: What it Github and how do I link to it and use it? I am afraid to set up Phaser locally as the process presumes too much computer knowledge. Even the detailed help tutorial on installation has too many options and paths. I have just loaded Linux Lite onto my old laptop that died after a Window 10 update. Can I load using this system?

However I have done some programming with Delphi and a C++ game engine so feel comfortable with the syntax of Phaser and can read and understand a lot of the code examples. Is there anyone out there who could just help get me up and running? I was thinking of writing up the process as a tutorial for others like me to get into Phaser.

"Phaser for Dummies and Old Farts - Getting started" would be the Title!



Link to comment
Share on other sites

Because Phaser is just JavaScript and based in the browser it means you can use anything else the browser can do too - Local Storage is an API available in most modern browsers that allows you to save / load key value pairs, so is perfect for small amounts of text based data. Here's a tutorial on how to use it: https://www.tutorialrepublic.com/html-tutorial/html5-web-storage.php

re: environment - to be honest, it sounds like you'd benefit from something like Phaser Editor, as you'd get a single interface to work, run and test from. You can, of course, set-up a free local equivalent yourself, but it sounds like you may save quite a bit of time opting for an 'all in one' solution instead. If you want to follow through the getting started guide then there are people here who will help if you get stuck on something. So don't feel like I'm saying Phaser Editor is the only way - because it's not - but it is a bloody good one :)

Link to comment
Share on other sites

Thanks for the advice. Will chase up the tutorial and look into the editor. Currently caravaning on East cost of Australia so will wait until I get home to do formal installs.

Yes agree that Phaser is a great game engine. Easy but very flexible.

Just visited the tutorial that you advised. It will be a great resource for me.

Thanks again

Edited by Julz57
added more information
Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...