• Content Count

  • Joined

  • Last visited

  1. Hey! In CANVAS mode this code works fine: this.scoreFont = this.add.retroFont('scoreFont', 45, 64, '0123456789', 10, 0, 0);this.scoreFont.text = '0';this.scoreDisplay = this.add.image(20, 20, this.scoreFont);However, with WEBGL the third line throws an error: Error: WebGL: texImage2D: null ImageData that appears to come from this function: gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.source);(from PIXI.WebGLRenderer.prototype.updateTexture). And the RetroFont doesn't show. Curiously, this WORKS in Chrome, but doesn't work in Firefox 35. Bug or am I doing something wrong?
  2. Yes, thanks. I was too quick to post. I use device emulation all the time to see if my responsive layout works in various setups. BTW, big thanks for scale mode RESIZE! It allowed me to drop several blocks of hackish resize code and still get the same effect!
  3. Hey! After upgrading from a previous version (2.0.something) to 2.2.2 I noticed that my orientation handling code (lifted directly from the Full Screen Mobile template) no longer works. This is my Boot.js: BasicGame = { /* Your game can check BasicGame.orientated in internal loops to know if it should pause or not */ orientated: false};BasicGame.Boot = function (game) {};BasicGame.Boot.prototype = { create: function () { this.input.maxPointers = 1; this.stage.disableVisibilityChange = true; this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; // this.scale.minWidth = 480; // this.scale.minHeight = 260; // this.scale.maxWidth = 1024; // this.scale.maxHeight = 768; // this.scale.pageAlignHorizontally = true; // this.scale.pageAlignVertically = true; this.scale.forceOrientation(true, false); //this.scale.hasResized.add(this.gameResized, this); this.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this); this.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this); // this.scale.setScreenSize(true); this.state.start('Preloader'); }, enterIncorrectOrientation: function () { BasicGame.orientated = false; document.getElementById('orientation').style.display = 'block'; }, leaveIncorrectOrientation: function () { BasicGame.orientated = true; document.getElementById('orientation').style.display = 'none'; }};With 2.0.x phaser.js lib, the above code displays my "please rotate device" image when the orientation changes to portrait. After swapping for 2.2.2 phaser.js, it doesn't work. The functions "enterIncorrectOrientation" and "leaveIncorrectOrientation" never actually run (I tested it with console.log), so I guess either the Signals are not added or Phaser doesn't detect orientation anymore. API change? What should I try instead? I guess I could use .setResizeCallback instead, then add a test for example if window.innerWidth < window.innerHeight then display the orientation image, so there's that. But I'd prefer to use a built-in Phaser's method if possible.
  4. I know how to use multiple pointers, but I need to be able to DETECT if the device is CAPABLE. It seems that I actually skipped a crucial sentence in my post, sorry for the confusion. My question is: is it possible to detect the maximum number of touch points the current device can track at once (or at least: is it possible to detect if it's > 1). Bonus question: is there a significant share of mobile devices currently in use that can only accept one touch point.
  5. Excellent. Just a general usability note: it's more convenient if the source is listed directly under the example. Phaser's official examples are perfect in terms of presentation.
  6. Well, that sounds even better. Are you planning to make some "baby steps" examples (like the Phaser examples - one minor feature at a time)? From your experience - how many isometric tiles can I expect to display at 20-30 FPS on a mid-range phone (something like a Galaxy S3)? Is there a significant performance drop if I make the world much bigger than the display size, or is your plugin optimized to only process tiles that are currently visible?
  7. Great work! I have several ideas that had to be put on hold because there was no good isometric solution (and I wasn't confident enough in my JS skills to make one). Right now I'll still have to wait for the optimization though - it works @30 fps in a modern desktop browser, which means it will be completely unplayable on mobiles.
  8. Hi! My default interface requires at least 2 touch pointers, but I could provide a slightly more awkward alternative with only 1 touch point requirement if I detect that the device does not support simultaneous touches. Two questions: 1) Can it be done with Phaser (or JavaScript in general)? 2) Is it necessary anyway? I personally don't even know any devices with only 1 touch point, but I guess the templates that come with Phaser have .maxPointers = 1 for a reason. Are there many devices with only 1 touch point? Thanks for help. To clarify, my interface would be as follow: - touch left side of the screen to move left, - touch right side of the screen to move right, - you can't move left and right at once, but I want the 2nd touch (for example, right) to be detected even if the user is still touching left - this way I think it's slightly more responsive.
  9. THIS! In my opinion this is the only scaling mode that looks professional (black borders? not even accepted by most sponsors anymore; stretching assets? horrible), I hate the fact I need to hack around Phaser just to get this working. It's really the only thing about Phaser that I dislike.
  10. In my case, cancelling was undesired. In that particular game, it was much better to allow to continue dragging even after accidentally hitting the border. It is game-specific though. Your code will ofc work.
  11. I had this problem too. I had no idea how to fix it within Phaser, so I just hacked a workaround by adding my own listener for onMouseOver, something like this: this.div = document.getElementById('game'); this.div.onmouseover = this.onMouseOver; and then I had a function: onMouseOver: function(e) { if (e.buttons >= 0) { //mouse returned with the button still pressed, continue dragging } else { //mouse returned with the button released, add code to stop dragging } }
  12. I had this problem too, I think it's actually bugged in Chrome (try several different phone presets, some of them should work). I managed to fix it and I *believe* that this is the change that made it (it was necessary for something related to Chrome dev tools anyway ): In Phaser.Mouse (src/input/Mouse.js): start: function () { if ( && === false && { // Android stock browser fires mouse events even if you preventDefault on the touchStart, so ... return; }//LEAVE THE REST UNCHANGED}The "" check is added.
  13. Thanks. It was extremely helpful.
  14. Thanks, my library will probably have this book, I'll check it out. Some things you said about prototypes and 'static' properties caught my attention, so let's take a look at, for example, ScaleManager.js (AFAIK it doesn't extend anything, which should make it a bit easier). It starts with: Phaser.ScaleManager = function (game, width, height) { = game;//a lot more code var _this = this;//some more code};Phaser.ScaleManager.EXACT_FIT = 0;My questions about this snippet (especially no. 1 is quite confusing to me): 1) Why does work, and is non-static? It's not added to the prototype, unless the this. makes some kind of a shortcut. 2) I suspect that Phaser.ScaleManager.EXACT_FIT = 0; is 'static', is that correct? 3) I think that var _this is local and available only from the function, is that true? 4) Would I be able to do Phaser.ScaleManager.prototype.myVar = 3; (outside of function definition) and if yes, what'd be the difference from having this.myVar = 3; (in the function definition)? 5) Is Phaser.ScaleManager effectively a constructor?
  15. Thanks, I got more from this answer than I hoped. You seem to be very knowledgeable, and I have some problems adapting to JavaScript's way of OO programming. Could you recommend any good materials to help me understand how prototypes work? I "know" how to use them in a sort of "class method definition" way, but I'm pretty sure I don't actually understand what's happening there.