Jump to content

Search the Community

Showing results for tags 'localstorage'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 13 results

  1. Hello, I'm making a browser game where the only saving is done to localstorage with JSON data. I've seen some odd behaviour and wondered whether locastorage is actually reliable enough for save data and whether its worth putting in a backup / saving somewhere else too just in case? All opinions welcome.
  2. I've read a few articles on how phaser games can be deployed onto steam however I can't find anything related to how to store the data in this case. Essentially what i would want to do would be to create a game that runs on windows and save data locally instead of relying on the internet to handle save progress. Could anyone provide details on what options are available? Is it possible to still use local storage if the game is an exe file?
  3. I want to know how to keep the localstorage save data persistent in my game. If i reset my device the locally stored data is lost Eventhough i'm not clearing the cache. I'm trying to save highscore and stuff. How do i keep it persistent should i keep some log on the server? I'm running the game on Chrome fyi
  4. hey guys I'm currently after completing a tutorial at http://zenva.com . I have been working on my knowledge with phaser. anyways, after finishing the tutorial i decided to polish the game. I am new to the localstorage api and was looking for some help. here is my code for the highscore. it currenly doesnt work with localstorage and im not sure why. Any help is much appreciated init: function(score) { var score = score || 0; localStorage.setItem("score", this.highestScore); this.highestScore = this.highestScore = localStorage.getItem("score"); this.highestScore = Math.max(score, this.highestScore); if(this.highestScore === null) { localStorage.setItem("score", "0") this.highestScore = localStorage.getItem("score"); } }, Here is the full file. Just incase its needed var SpaceHipster = SpaceHipster || {}; //title screen SpaceHipster.MainMenu = function(){}; SpaceHipster.MainMenu.prototype = { init: function(score) { var score = score || 0; localStorage.setItem("score", this.highestScore); this.highestScore = this.highestScore = localStorage.getItem("score"); this.highestScore = Math.max(score, this.highestScore); if(this.highestScore === null) { localStorage.setItem("score", "0") this.highestScore = localStorage.getItem("score"); } }, create: function() { //show the space tile, repeated this.background = this.game.add.tileSprite(0, 0, this.game.width, this.game.height, 'space'); //give it speed in x this.background.autoScroll(0, 10); //start game text var text = "Tap to begin"; var style = { font: "30px Arial", fill: "#fff", align: "center" }; var t = this.game.add.text(this.game.width/2, this.game.height/2, text, style); t.anchor.set(0.5); //highest score text = "Highest score: "+this.highestScore; style = { font: "15px Arial", fill: "#fff", align: "center" }; var h = this.game.add.text(this.game.width/2, this.game.height/2 + 50, text, style); h.anchor.set(0.5); }, update: function() { if(this.game.input.activePointer.justPressed()) { this.game.state.start('Game'); } } };
  5. So I have a huge question that I just can't seem to find the answer to. A player has 5 characters they can move across the board. Each character has their own movement allowance (some can only move 1 square per turn while others can move 2 or 4). The player has a TOTAL of 5 moves per turn. So they can move their characters 5 squares however they please. My question is, after every turn, I want to make a database call to track their position so in case if they refresh the browser or come back to the game later, their characters are in the same position. If I store this information in localStorage, can't they just update their character's position manually and potentially move a character that can only move 1 square up to 10 if they please? I don't know how to secure this without making a database call EVERY TIME they click a square which would be way too many requests and could slow the game down a LOT, right? And when the character moves, I'll be doing a check that looks similar to: if (path.length > character.movement_allowance) { // Then don't allow them to move } Couldn't they just update it to 10 via dev tools if they wanted to? My players object will look similar to this: players: { 0: { name: 'Red Fox', movement_allowance: 2, pos_x: 2, pos_y: 3 } } Couldn't they just update their x and y position? And even their movement_allowance? I'm just out of ideas here unless I check the server side every time they move to make sure it's correct and validate it..
  6. I am trying to store from this code: Potato.upgradeButtonsData = [ {icon: '1stUpgrade', PIcon: 'potato4Upgrade', background: 'upgradeBg', themeText: "", name: '', level: 1, cost: 100, pas: 100, purchaseHandler: function(button, player){ Potato.player.clickDmg += 0.2; }}, But the problem is that when I try it either says "Nan" or will just do nothing. I am using localStorage because i could not get the store.js thing to work. And if you have to store all the items(by all the items i just mean (level, cost and pas)) like an Array then I dont know how to. I am pretty new to Phaser This is the code I am using to store the items in the list: if(localStorage.getItem('numL') === null){ console.log("Creating localStorage 'numL"); localStorage.setItem('numL', Potato.upgradeButtonsData.level); } if(Potato.upgradeButtonsData.level >= 1){ Potato.upgradeButtonsData.level = localStorage.getItem('numL'); } Potato.upgradeButtonsData.level = parseInt(localStorage.getItem('numL')); And in the update method: localStorage.setItem('numL', Potato.upgradeButtonsData.level); Any help would be awesome! EDIT: I have more than 1 item in the lists in my actual code, this is just an example
  7. Hi! This is my first time creating a game via a tutorial which I've coded along with so I am a completely new at this but I am eager to learn. I've this game "Bunny Defender" and want to create a simple High Score which I can store in some kind of localstorage with ex XML and display the high score result out on the screen when the game is over. I don't know how to do this and where to start. Would be very thankful if someone could point me at the right direction and how to manage this? // The complete game online http://rewindlevel.net/ // All the game files on github https://github.com/eiffelqiu/bunny-defender /Rookie Boy
  8. Hi there, I want to know if there is a way to remove from Phaser, completely the use of localStorage, I'm working on a google Ad and Double Click Studio does not support this feature, and also I'm not using it, so I want to remove from the engine, someone knows if this could be possible. Regards.
  9. Hi, How to display best score in game using local storage? or is there any other better way I can do this with Phaser? If possible give a example code. I used method from this tutorial http://www.codevinsky.com/phaser-2-0-tutorial-flappy-bird-part-5/ but it give error: Localstorage is undefined Thanks
  10. So i want to implement a simple save and load feature in my game. After reading some threads i think something like this is sufficient. localStorage.setItem('myObject', JSON.stringify(myObject)); But after seeing this about localstorage: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage#localStorage Important: This guide is out-of-date. For up-to-date information on Web Storage, you should visit the Web Storage landing page for reference, and ourUsing the Web Storage API guide for a walkthrough. And i see that store.js also using, i think, this way of saving objects... Well my question is how do i save and load an object the best way and that it is still usable after a while (not deprecated)
  11. So yes Chrome has its own local storage API. I used chrome.storage.local.set({"item": itemValue});and chrome.storage.local.get("item", function (result) {console.log(result);});For all my storage calls. The problem I face is Phaser.js includes localStorage statement somewhere inside of it, which doesn't allow me to view my game at all. So Instead I get this error in console: window.localStorage is not available in packaged apps. Use chrome.storage.localand a black screen. What would you do in this case? Is there some functionality I could turn off in Phaser or I just don't bother with Chrome Web Store at all?
  12. Hello all, I'm building an update scheme for my game where the user downloads the new assets from the server. Every bitmap and JSON files will be stored under @cocoonjs localStorage file for further use. The thing is, I just can't find a way to initialize a sprite sheet on PIXI.js by passing the JSON and bitmap data instead of the JSON location. Anyone knows an workaround to register a sprite sheet on PIXI.js at this scenario? All the best, Epa
  13. Hello there! I'm using localstorage to save some data like scores,credits etc. What happens if another game on the portal i submitted my game uses the same keyword to store,lets say , the score? Is it possible to mess the player's storage ? Or does the site or the browser takes care of this? What happens when i use localStorage.clear() ? Does this delete everything on the player's storage? Or just the values i assigned on my game? Sorry if those questions are dumb but i'm currently got some issues on a game i uploaded on gamejolt.com Thanks in advance!
×
×
  • Create New...