• Content count

  • Joined

  • Last visited

About luschn

  • Rank
  • Birthday 12/16/1980

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
  • Location

Recent Profile Visitors

382 profile views
  1. Disable Antialias in Phaser 3

    that´s it, thank you so much! could not find this in any documentation or the examples, but i guess that´s because phaser 3 is brandnew...
  2. In Phaser 2, there was a simple parameter you could set to disable antialiasing/smoothing, but i cannot disable it in Phaser 3. I assumed it should be in the config object like this, but it did not work: const config = { width: window.innerWidth, height: window.innerHeight, parent: 'canvas', type: Phaser.AUTO, physics: { default: 'arcade', arcade: { gravity: {y: 0}, debug: true } }, scene: [ Preloader, Game ], antialias: false }; const game = new Phaser.Game(config); Is there another way to disable it? I found "game.config.antialias" in the phaser.js file, but i tried with "false" and "0", nothing worked. I also found it in the WebGLRenderer.js file and it looks like it should be a boolean - but still, it did not work. I tested it with <canvaselement>.getContext('webgl').getContextAttributes().antialias and the value is always true.
  3. setCollideWorldBounds on Retina Displays

    that actually led me to the solution, thank you! i thought that i would have to multiply the devicePixelRatio on mobile to make it repsonsive (read about it in some phaser tutorial), but it´s still just window.innerWidth in the config. after that, everything works perfectly fine! not sure why i did not just try it...
  4. setCollideWorldBounds on Retina Displays

    it even happens before resizing (did not even implement resizing yet), and there is not really more code. i thought that i included all the relevant parts, to be honest.
  5. I just tried to set the world bounds for a player sprite in a responsive game with the following config: const config = { width: window.innerWidth * window.devicePixelRatio, height: window.innerHeight * window.devicePixelRatio, parent: 'canvas', type: Phaser.AUTO, physics: { default: 'arcade', arcade: { gravity: {y: 2500}, debug: false } }, scene: [ Preloader, Game ] }; In the game itself, i created a player sprite like this: this.player = this.physics.add.sprite(this.screenWidth * 0.2, this.screenHeight * 0.5, 'coin'); this.player.setCollideWorldBounds(true); It places the object correctly, and on desktop the player object hits the ground and stops there. On mobile, it does not stop at the bottom though, because of the pixel ratio. Is that a bug? Or is there just some settings to use setCollideWorldBounds correctly on mobile devices and responsive games?
  6. there´s nothing on the div, nothing on the body, ... really weird. and still, it does make a difference for me if i create the div on my own. maybe i´ll try it in a fresh html file later...
  7. ok, it may not even be related to react. i found out that resizing does not work correctly if i add the canvas div on my own (<div id="canvas"></div>) - if i don´t add any canvas div and let phaser create it > works perfectly fine. in that case, there is no div around the canvas tag.
  8. you know what, it suddenly worked. i only changed some react stuff (my game runs on react and phaser) - using a single route now, with phaser only. i had several routes before, because my game will get pretty big with many states and i wanted to create webpack bundles for several code parts....but i may even remove react now, because now it´s pointless if i just load phaser... anyway, react messed it up, not entirely sure why (because there was no additional content next to phaser). maybe someone knows what could go wrong, but i would consider this closed for me
  9. In order to create a fully responsive game, i´d like to listen to the resize event, but it only gets called when i resize the screen to smaller values. This is my code (well, part of it): export default class MainState extends Phaser.State { constructor() { super(); } init() { this.scale.scaleMode = Phaser.ScaleManager.RESIZE; } resize(width, height) { console.log(widht, height); } } In the resize callback, i resize my game elements - they obviously get smaller when i make the screen smaller. But if i increase the size of the window again, the callback never gets called. Is there any workaround for this? Is this a known issue?
  10. AngularJS + Phaser: dynamic loading/unloading

    i may just end up using react server side rendering instead, would be better for SEO anyway and it would solve the rendering issue...
  11. AngularJS + Phaser: dynamic loading/unloading

    found more information about the issue - seems to be fixed in pixi.js v3 - but the latest phaser version (v2.4.6) uses v2.2.9 of pixi.js: can we somehow upgrade to pixi.js v3? would be better than using workarounds...
  12. AngularJS + Phaser: dynamic loading/unloading

    I am using React with Phaser and would like to split my Code with different Phaser instances, so i am stuck with the same problem and Phaser v2.4.6: After the fifth time i initiate Phaser, the screen goes black. Did anyone find a solution for this? I don´t want to create a global Phaser instance, it´s not always visible and i would have a LOT of states...
  13. Official Phaser 2.0 Book - Looking for feedback

    option 2, of course class references should be available online, it would be a waste of time to put them in a book. after all, those things usually change a lot. so it would be better to have a book that explains the principles of phaser. because even if the classes change a lot, the main principles will stay the same or very similar.
  14. Stop Chained Tweens

    are you sure resume starts from the beginning? the pause example with resume does not, and resume usually means...well, resume, not restart
  15. You can just use "Modernizr" to test if the browser supports canvas: if (!Modernizr.canvas) { ...}