jjwallace

Members
  • Content Count

    146
  • Joined

  • Last visited

Everything posted by jjwallace

  1. Great call kids! I encapsulated the code and it works well! You saved me, my client would have been very unhappy.
  2. Hi, can you please ad my latest game. Missions 1 and 4 are Phaser menu is Angular. http://www.goarmy.com/joinesd.html
  3. 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.
  4. 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?
  5. 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.
  6. Uncaught TypeError: Cannot read property 'preUpdate' of undefined Coming from Phaser - phaser.js: 33170 What could it be?
  7. 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'); } if(IApp.platform == 'tablet-l' || IApp.platform == 'phone-l' || IApp.platform == 'desktop'){ BGame.onLandscape = true; } if(BGame.onLandscape == true && this.ready == true && BGame.onCanStart == true){ console.log('Timer Start'); BGame.onCanStart = false; this.time.events.add(Phaser.Timer.SECOND * 0.3, this.startRenderGame, this); } console.log('Game Started'); this.state.start('Game'); },
  8. What came out of this? How do we destroy a game from Angular?
  9. Looking for a way to properly destroy phaser game. 2.4.7 this.destroy(); still not functioning in new update
  10. I prefer throwing my computer into the bathtube to destroy my phaser game.
  11. 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.
  12. 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
  13. 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; // a reference to the currently running game this.add; // used to add sprites, text, groups, etc this.camera; // a reference to the game camera this.cache; // the game cache this.input; // the global input manager (you can access this.input.keyboard, this.input.mouse, as well from it) this.load; // for preloading assets this.math; // lots of useful common math operations this.sound; // the sound manager - add a sound, play one, set-up markers, etc this.stage; // the game stage this.time; // the clock this.tweens; // the tween manager this.state; // the state manager this.world; // the game world this.particles; // the particle manager this.physics; // the physics manager this.rnd; // the repeatable random number generator }; var isSmallScreen = true; var isRainOn = true; ///////LOTS OF VARIABLES HERE FunGame.Game.prototype = { create: function () { // gameFinished = false; // FunGame.gamePause = false; } }
  14. What if a phone doesn't have a gyro? Should we just check gamma === 0 ?
  15. 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].varSpeed); boomarang[i].y += (Math.sin((Math.PI*(boomarang[i].angle-90))/180) * boomarang[i].varSpeed);
  16. Lots of things have changed! For Questions like this see this site: http://caniuse.com/#feat=mp3
  17. 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));
  18. Awesome! I like how groups work, its pretty nifty!
  19. 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
  20. 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 detection is best? What are you thoughts ?
  21. 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); }, this);
  22. 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); }
  23. 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?
  24. Filter working! but now there is a conflict error with BaseTexture