Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by jjwallace

  1. You have to unload the instance of the game. You can encapsulate everything and just destroy it if you want. Sometimes with grunt and angular you will get a double instance of your game also its kinda a pain. Have you tried just destroying the instance of the game and loading another one?
  2. Great call kids! I encapsulated the code and it works well! You saved me, my client would have been very unhappy.
  3. Hi, can you please ad my latest game. Missions 1 and 4 are Phaser menu is Angular. http://www.goarmy.com/joinesd.html
  4. Fade from black when you start state (oncreate) this.camera.flash('#000000'); Fade to black from state: startGame: function (pointer) { this.music.stop(); this.camera.fade('#000000'); this.camera.onFadeComplete.add(this.fadeComplete,this); }, fadeComplete: function () { this.state.start('Game'); } Make sure you have the latest version of phaser.
  5. Ok so i have tried over 9 different methods here. What happends is some how the width and height are original pulled in via portaite mode and then when landscape occurs it still falls back to the original centerX and centerY from orientation change?
  6. Ok this is what i did but i didn't user the resize listener. This makes sense since i think it registers the landscape faster than the actual screen changes. I will move this function to the resize listener.
  7. Uncaught TypeError: Cannot read property 'preUpdate' of undefined Coming from Phaser - phaser.js: 33170 What could it be?
  8. I am trying to prevent my game from starting unless in landscape. I looked at a couple methods but none of them seemed to work. The problem is my game renders all objects and sizes them when it starts. I want to wait for the correct orientation but that takes a second from the variable being set and the actual dimensions changing. Is there a better way to do this? update: function () { if (this.cache.isSoundDecoded('sfxPredator') && this.ready == false){ this.ready = true; console.log('Preload Complete'); }
  9. What came out of this? How do we destroy a game from Angular?
  10. Looking for a way to properly destroy phaser game. 2.4.7 this.destroy(); still not functioning in new update
  11. I prefer throwing my computer into the bathtube to destroy my phaser game.
  12. Ahh i see what your are saying. However i am still not able to access mute because i am way out of scope. I need to find a better way of passing scope.
  13. var self = this.game; $(".audiotoggle").click(function(self) { if (MyApp.gameMuted === false) { MyApp.gameMuted = true; self.sound.mute = true; // self.audioToggle(); } else { MyApp.gameMuted = false; self.sound.mute = false; //self.audioToggle(); } }); Uncaught TypeError: Cannot set property 'mute' of undefined
  14. I have programmed a game with a lot of variables but i am having conflicts with my 6 other games running in NODE and ANGULAR. The problem is my variables are polluting the global namespace. What is an easy solution to this problem? I have a lot of variables and am looking into options such as refactoring. If you guys have any tips please let me know, this is for a very large project. VERY LARGE..... FunGame.Game = function (game) { //When a State is added to Phaser it automatically has the following properties set on it, even if they already exist: this.game; //
  15. What if a phone doesn't have a gyro? Should we just check gamma === 0 ?
  16. Why not just use trig and have a rotationSpeed variable and a rotationAcceleration variable? with rotationDegrade = true / false? rotationSteps = 0.1; if(boomarang[i].rotationDegrade == false){ boomarang[i].rotationAcc = rotationSteps; if(boomarang[i].rotationAcc > maxRotationAcc){ boomarang[i].rotationDegrade = true; } }else{ if(boomarang[i].rotationAcc >0){ boomarang[i].rotationAcc = -rotationSteps; } } boomarang[i].rotationSpeed += boomarang[i].rotationAcc; boomarang[i].x += (Math.cos((Math.PI*(boomarang[i].angle-90))/180) * boomarang[i].var
  17. Lots of things have changed! For Questions like this see this site: http://caniuse.com/#feat=mp3
  18. To find angle between points dx = (endX - startX); dy = (endY - startY); tempAngle = Math.atan((dy)/(dx))*180/Math.PI; movingStar.angle = tempAngle; To move star towards its angle movingStar.x += ((Math.cos((Math.PI*(movingStar.angle-180))/180) * movingStar.varSpeed)); movingStar.y += ((Math.sin((Math.PI*(movingStar.angle-180))/180) * movingStar.varSpeed));
  19. Awesome! I like how groups work, its pretty nifty!
  20. TypeError: texture.baseTexture.on is not a function {stack: (...), message: "texture.baseTexture.on is not a function"} message: "texture.baseTexture.on is not a function" stack: (...) get stack: function () { [native code] } set stack: function () { [native code] } __proto__: Error
  21. I have a challenge, maybe someone has already done it. Say you have a bunch of game elements that are clickable on a screen. You have a png on top of them, there is a circle in the png and the elements are moving around in the circle. You want to click on the elements inside the clear alpha circle but not when they are hidden behind the PNG's non alpha sections. How would you guys do this? Would you take the x y of the pointer and detect alpha of the foreground PNG? Or would you do a trig equattion? What if you want it to be responsive, maybe doing bitmap pixel detect
  22. Uncaught ReferenceError: tempScope is not defined creature[e].anim.onLoop.add(function(tempScope){ console.log("Loops"); console.log('animation complete'); //creature[e].anim.remove(); tempScope.loadTexture('organism'+tempScope.varType); //temp scope = this = creature[e] ?? tempScope.angle *= -1; tempScope.x = -1000; tempScope.y = tempScope.world.randomY; tempScope.varSpeed = Math.floor((Math.random() * 4) + 1);
  23. create: function () { if(BasicGame.onMobile == false){ var displacementTexture = PIXI.Texture.fromImage(BasicGame.rootURL + "assets/img/displacement_map.jpg"); //PIXI.BaseTexture displacementFilter = new PIXI.DisplacementFilter(displacementTexture); }
  24. I am trying to get shaders to work in Phaser, I see a plane Deformation working in phaser but what about something like this? https://www.shadertoy.com/view/4s2Xzc How easy is this?
  • Create New...