Doug

Members
  • Content count

    54
  • 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. 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!
  2. 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!
  3. 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
  4. 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.
  5. 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.
  6. 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!
  7. 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.
  8. 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.
  9. Doug

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

  10. 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)?
  11. 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
  12. 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
  13. Doug

    Rotation of arcade physics body

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

    Rotation of arcade physics body

    Great thank you. Will do.
  15. Doug

    Rotation of arcade physics body

    Thanks, that's really kind of you. Just did the same to check it and it still fails here. It rotates the game object, but not the physics body. let t = this.physics.add.sprite(200, 200, 'sprites', 'windSock_0000'); t.angle = 30;