• Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by rich

  1. rich

    Ellipse Collision

    No, Arcade Physics is rectangle and circle only. Use Matter.js if you need any other shape.
  2. rich


    It's likely not a valid texture key then. With no code or assets to see you'll have to figure this one out yourself, but that's the right method to call in Phaser 3.
  3. rich


    It’s not a valid function at all, for anything. Use setTexture instead.
  4. rich

    Load resources out of preloader events/&q=
  5. rich

    Getting a reference to events

    When a TimerEvent has completed (i.e. reached its duration, or repeat limit) it will be moved to the `_pendingRemoval` array within the Clock class. This is purged at the start of every game step. Or, you can invoke it directly by calling the `removeAllEvents` method. If you do this, all TimerEvents are immediately flagged for deletion. The TimerEvents are a bit of a misnomer re: their naming, because they're not actually Events in the EE3 sense of the word, and aren't emitted in the same way internally. They do, however, self manage themselves. They hold no outside references other than the callback they invoke, so as long as you let the Clock class clean them up, they shouldn't linger in memory at all. The only exception is when you set them to loop infinitely.
  6. rich

    Phaser Game crashes?

    Scope, scope, scope, scope. Your function scope is wrong. Where-ever you are calling "freeChicken2" from, the scope inside of it doesn't match the State, which is why "" doesn't work.
  7. rich

    Tilemap Displays Grid Lines (Render Artifacts)

    Here, this will help:
  8. rich

    Using a simple spritesheet animation without key

    Just call generateFrameNumbers without passing anything but the key of the sprite sheet: frames: this.anims.generateFrameNumbers('spriteSheetKey')
  9. rich

    Getting a reference to events

    Early versions of v3 (while still in beta) used this approach, and it was replaced with the current way (of the actual values being passed to the callback), because in order to use the first approach you have to create new Event objects and then populate them with the relevant data every single time. As events were worked into some really hot areas of code (update loops, input handlers, tweens, animation, etc), this constant object creation and reallocation was taking up considerable CPU time for no tangible benefit. Now that every Game Object is an event emitter it's crucial they don't waste time doing this. Also, we use EE3 for event handling, which offers no control over event propagation or destruction (again, it's eschewed in favor of performance) Had Phaser been a typical web app I'd have kept the original approach, but as it's for making games, every little bit counts - and when you have got a game with potentially tens of thousands of event emitters running around, it's important they're as lean as can be. In short, the reason you can't get a reference to the event as such, is because there isn't one. This doesn't mean you can't emit your own events internally though. There's nothing stopping you from having your game create new Event objects and have those emitted and handled by the callbacks, it's just the internal Phaser generated events don't.
  10. Signal callbacks need to be a reference to a function, which is only run when the event fires. You should likely change your code to be: `onOutOfBounds.add(resetBox, this)` (assuming resetBox is in the local scope)
  11. rich

    play video in Pharse3

    There's no Video object in v3, you'll need to implement it yourself.
  12. rich

    Collider in group does not work

    I still don't really get why you can't create everything you need up-front, the moment the game starts. Create your bombs group, create the player, create the colliders. Then in the Socket callbacks all you need do is create the bombs themselves, within the pre-existing Group. The fact you're having to use setTimeout is a big red warning flag there are structural problems in the code imho.
  13. rich

    Phaser 3 & TypeScript

    Phaser.scene.load.spritesheet wouldn't work from JS either
  14. rich

    Collider in group does not work

    Don't add the collider inside the socket function, or it will create a brand new collider ever time that function is called, which I'm pretty sure is not what you wanted. Instead, try and get it working without using a Socket connection at all - do the bombs work locally? If so, I think it's likely just a scope issue.
  15. Hi all, I'm really pleased to announce the release of our second plugin. This time I've tried to cover everything that you may need from a virtual joystick plugin, including 3 quite lovely looking skins to use. Analogue + Digital Joysticks and Buttons3 Professionally designed skins inc. PSDsPowerful and friendly Plugin APIJSDocs, PDF Manual and Code Examples The Phaser Virtual Joystick Plugin allows you to easily add mobile friendly joysticks, d-pads and buttons to your games. The plugin comes with three high-resolution professionally designed skins. So the joysticks will both look great and respond quickly. Photoshop PSD files are also included allowing you to create further skins. The shop page is here: There are also 14 examples of it in action here: (excuse the horrible watermark on the graphics, but I had to protect them somehow) The full feature list: 3 professionally designed high-resolution Joystick skins and Button statesEach skin includes Photoshop PSD files for customisationSupports Analogue Joysticks, Digital (DPad) Joysticks and ButtonsCreate as many joysticks as you need on-screen at once. Dual-stick shooter? No problem!Create as many Buttons as you need, each with their own style and eventsJoystick events: onDown, onUp, onMove and onUpdateAdjust the sensitivity of the JoystickUses a custom Input Manager that won't conflict with any input enabled Game ObjectsJoysticks can be axis locked so they only move horizontally or verticallyIncludes DPad class for the classic retro feel! For fixed-axis 4-way movementRenders outside of the game World, so not impacted by scaling or camera movementJoysticks and Buttons can be easily positioned, scaled, alpha'd or made invisibleJoysticks can be set to only appear when the player touches the screenEasily read the force of the joystick both globally and per axisEasily read the angle of the joystick in multiple formatsCreate a Joystick 'dead zone' inside of which events are not processedControl the Button repeat rate - how often it should 'fire'Includes properties for easy use with shadersHandy debug method visually renders the hit areas and joystick valuesWorks across mobile and desktop browsersWorks under Chrome Mobile Emulation including multi-touch environmentsGetting Started Guide - You'll be coding in next to no time14 Code Examples included - View them all onlineExtensive JSDoc API Documentation - all properties and all methodsFree UpgradesLicense free - Use it in commercial gamesReady built and minified source filesWorks with Phaser 2.2 and above Hope you like it!
  16. rich

    inheritance in phaser 3

    Here is how to do it using ES5:\game objects\images\custom image class.js and here is how to do it using ES6:\game objects\images\custom image class ES6.js
  17. rich

    Support Phaser V2

    Phaser v2 is continued in Phaser CE, which has had many releases and is still on-going.
  18. rich

    Pixelart while moving it gets blurry

    You can't have crisp pixels if you zoom the camera by 2.5 - keep the zoom level at 1, or at the very least, constrained to integers.
  19. rich

    Trouble changing Scenes in Phaser 3

    Use the Scene key to swap to it: this.scene.start('sceneMainGame'); and make sure that your main game Scene has been added to your list of Scenes in your game config.
  20. rich

    How do I use this spritesheet in Phaser 3?

    You could also use Shoebox and its "Extract Sprites" feature, which will scan the png and rip out all of the images it can find. Might save you some time:
  21. rich

    Playing GIFs in Phaser 3

    Can’t see why not. I mean you’d only get the first frame, just like in canvas, but the browser can load it and there’s no logical reason it can’t make a gl texture from it.
  22. rich

    Playing GIFs in Phaser 3

    If you don't need to do too many of them then I personally use - you can upload a gif then split it to frames and download as a zip, can also do other edits too, then it's easy to string back together in an app like texture packer or shoebox.
  23. rich

    Prevent game pause

    You can’t. The game doesn’t pause, it’s the browser that pauses because the tab is inactive. It also happens if you open another app like notepad and drag it so that it covers up the browser. It knows you can’t see it, so it throttles processing down to the absolute minimum needed. Browsers have done this for a while now as it saves battery life on non desktops.
  24. rich

    can't get frameName setter to work

    Well, there's no such property as 'frameName' on Game Objects in Phaser 3, so setting it won't have any effect. To change a frame you should use setFrame. To change a texture, setTexture.
  25. rich

    Updating existing texture with canvas content

    This changed in 3.7 so it now returns a CanvasTexture object, which is a lot easier to work with. Try the following: var config = { type: Phaser.AUTO, parent: 'phaser-example', scene: { create: create } }; var texture; var game = new Phaser.Game(config); function create () { texture = this.textures.createCanvas('gradient', 16, 256); // We can access the underlying Canvas context like this: var grd = texture.context.createLinearGradient(0, 0, 0, 256); grd.addColorStop(0, '#8ED6FF'); grd.addColorStop(1, '#004CB3'); texture.context.fillStyle = grd; texture.context.fillRect(0, 0, 16, 256); // Call this if running under WebGL, or you'll see nothing change texture.refresh(); // Add a bunch of images that all use the same texture for (var i = 0; i < 64; i++) { var image = this.add.image(8 + i * 16, 0, 'gradient'); this.tweens.add({ targets: image, y: 650, duration: 2000, ease: 'Quad.easeInOut', delay: i * 62.5, yoyo: true, repeat: -1 }); } this.time.addEvent({ delay: 4000, callback: updateTexture, callbackScope: this, loop: true }); } function updateTexture () { var grd = texture.context.createLinearGradient(0, 0, 0, 256); grd.addColorStop(0, generateHexColor()); grd.addColorStop(1, generateHexColor()); texture.context.fillStyle = grd; texture.context.fillRect(0, 0, 16, 256); // Call this if running under WebGL, or you'll see nothing change texture.refresh(); } function generateHexColor () { return '#' + ((0.5 + 0.5 * Math.random()) * 0xFFFFFF << 0).toString(16); }