Jump to content

Search the Community

Showing results for tags 'Destroy Game'.

  • 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 1 result

  1. Hi Guys, I am new to this community and this is actually my second post, but my first one didn't appear. So I hope I am not posting my question twice. If it does appear, my apologies! Anyhow, I am pretty stuck on a problem. I found a dirty work around, which I would really like to get rid of though. I think the problem is a little bit more complex and I don't know if I am making the right assumptions considering my solution, but I hope somebody tried the same with a different solution approach. So here we go: Basically, I am trying to switch in and out of my game, over states with Angular. I set up a simple controller, which is been given my <div> container in a template, which I add my game into when I switch to that route. The way I load my game into the container when I hit the state/route is that I wrote my own lazy loading function that loads my game setup: (function() { var game = new Phaser.Game(screen.width, screen.height, Phaser.CANVAS, 'gameCanvas'); // add our game states game.state.add('boot', MMM.Boot); game.state.add('preload', MMM.Preload); game.state.add('main-game', MMM.MainGame); // start with the booting state game.state.start('boot');})(); When I exit my game and return to my menu controller, I remove my script again from the <head> and destroy the phaser game and I try to clear the cache with this.game.cache.destroy() If I want to enter my game again I just load the above script again with my lazy load function. It enters my game just fine, but i get the following error: Uncaught TypeError: Cannot read property 'cache' of null I tried reloading all of my game related scripts including my preload script, but the error stays the same.The assumption that I made was that the game is not actually completely destroyed and thus has some remains which cause errors. My work around is to do a $window.location.reload(false); and load everything again from cache. Works without any errors and loads quickly, too, but I really don't like how I am going about this. Any recommendations? Thanks in advance!
×
×
  • Create New...