Doug

Members
  • Content Count

    56
  • Joined

  • Last visited

About Doug

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi Quick one (hopefully). Is using the resolution setting the best way to deal with HDPI screens on mobile? i.e. set the game size to the innerHeight and innerWidth of the screen and then set the "resolution" setting to the devicePixelRatio. It seems to work, but I am getting a bit of a performance lag. I assume just because the higher resolution means that device is working harder rather than because it's not the proper solution? Thanks :) D
  2. Doug

    Changing scenes

    I am sure this is a completely dim question, but I can't find what I'm looking for. I'm using Angular4 with phaser: this.phaserGameConfig = { type: Phaser.WEBGL, width: width, height: height, parent: 'game-play', scene: null }; this.phaserGame = new Phaser.Game(this.phaserGameConfig); this.phaserGame.scene.add('GAME_0_Loading', new GAME_0_Loading(this.phaserGameConfig, this), false); this.phaserGame.scene.add('GAME_1_Welcome', new GAME_1_Welcome(this.phaserGameConfig, this), false); //etc I have around 10 scenes and I need to change between them so that each time the scene loads it starts afresh each time. i.e. any old scenes are completely destroyed and when I load the scene all the elements load from scratch as if the scene has never loaded before. I was thinking that the way to do this would be: this.phaserGame.scene.start(sceneName); However, when I do this I am seeing what appears to be legacy stuff from previous instances of the scenes. I am finding that I am having to do: this.phaserGame.scene.stop(theCurrentSceneKey); To prevent very odd overlays of buttons etc on scene changes. Further, tweens that I have used to bring elements into the screen are taking more time before they run each time one particular scene loads. As if the time delay for the tween is being added to on each load of the scene. Any guidance would be appreciated. If you need any more code samples then let me know Thanks!
  3. Doug

    Phaser3 and Ionic Framework

    OK, so I think I may have worked out what's going on here, but I'd welcome feedback as to whether I'm correct and how to resolve it please. When I run `ionic serve` my games run perfectly. When I do `ionic build` and open the files directly in a browser they fail. This, I have now realised is a dim mistake because a web server is required to serve phaser games. So if I run a basic python web server in the www build directory with `python -m SimpleHTTPServer` I can then browse to the game in the web browser at http://localhost:8000/ and boom, the games are working. So, the question is.....Is the reason that the games in my ionic app fail that they are not being run with a webserver when they are running in a compiled app? If so, then how do I get around that? Thanks very much!
  4. Doug

    Phaser3 and Ionic Framework

    Hi All I'm developing a mobile app with ionic framework and Phaser 3 and am having some problems. When I run ionic serve the app opens in the web browser and works fine. However, when I run ionic build I have problems. I know that Phaser loading because I am seeing the following in the console (this is running the version that has problems when I ionic build it): However, I get a black screen rather than any game content. I am including phaser in the index.html file: <script type="text/javascript" src="assets/libs/phaser/phaser.min.js"></script> Then referencing it within my component: declare var Phaser: any; As I say, it works fine until I do a full ionic build. Anyone seen this before? Any ideas why it would happen please? Thanks!
  5. Doug

    Destroying a matter.js rectangle body

    Just to follow up on this, I can confirm that @rgk was right. I changed the code to the following and it all works. this.matter.world.remove(this.wireRect); Thanks again
  6. Doug

    UI Elements on Phaser 3

    I would probably avoid trying to create the login form etc within Phaser. As @snowbillr has hinted at, this would not be all that easy and you're going to need a workaround. Maybe a better approach would be to create an HTML form within a div with a background so that it looks pretty and as if it's a part of the game, but is actually just pure html, css, JS etc and then create or show the Phaser game instance after the login has been processed.
  7. Doug

    Destroying sounds - best practice

    Thanks very much @samme - I am actually using the latest version of Phaser, but I just had another look at my code. It's pretty complicated in there now and it looks like there was one instance where I wasn't destroying the game properly, but just closing the modal. I've amended it now and so far it appears to have done the trick. So I'll do some more testing. Thank you and sorry for wasting your time if it was this.
  8. Doug

    Destroying sounds - best practice

    @rich Sorry to bother you, but I'm still struggling with this one and it's causing me a lot of headaches. What is the best way to completely remove sound from the DOM please? Thanks!
  9. Doug

    onkeyup event (onUp)

    You're most welcome. I assume you've found the documentation here too: https://photonstorm.github.io/phaser3-docs/list_namespace.html Between the labs and the docs you should have everything you need. Enjoy! It's a great framework.
  10. Doug

    Destroying a matter.js rectangle body

    You are a legend, thanks. I can replicate this working in the example page you sent too Will have a go at implementing in my code as soon as I have a chance. Thanks very much! Greatly appreciated.
  11. Doug

    Hi Rich.  @rgk mentioned that you might be able to please add a "patron" badge to my forum profile?  Thanks very much!

  12. Doug

    Destroying a matter.js rectangle body

    Thanks very much. However, the objects still accept collisions etc and also still show up in debug mode. Have you had this working successfully? Just out of interest, how did you get the "Phazer patron" badge to display (I am a patron, but it's not showing for me)?
  13. Doug

    onkeyup event (onUp)

    Hi Josh I think you're looking for this: http://labs.phaser.io/edit.html?src=src\input\keyboard\keydown.js You just replace `keydown` with `keyup`. e.g. this.input.keyboard.on('keyup_A', function (event) { console.log('Hello from the A Key!'); }); I hope this helps and let me know how you get on D
  14. Hi all I'm creating a matter.js rectangle body with the following code: let wireRect = this.matter.add.rectangle(w.x, w.y, this.wireLength, 10, { restitution: 0.9, isSensor: true, angle: angle }); I then later need to remove it from the game. wireRect.destroy(); returns an error "wireRect.destroy is not a function". I have another game in which I am using this.matter.add.image(XXX) and the .destroy() method works fine on those. So I tried: this.matter.world.remove(this.matter.world, wireRect); That doesn't seem to work either. I can see matter.body documentation https://photonstorm.github.io/phaser3-docs/MatterJS.Body.html, but can't see how I would find the correct destroy method for it. Any ideas welcome please! Thanks
  15. Doug

    Rotation of arcade physics body

    No problem at all. I really appreciate that you tried.