• Content Count

  • Joined

  • Last visited

  1. I figured out why my sprites where scaled wrong. I did this: this.game.width = 1920; this.game.height = 1080; Instead of this: this.game.scale.width = 1920; this.game.scale.height = 1080; Now everything works as expected.
  2. Thank you very much. That worked. When I now add sprites, they are scaled wrong though. Although I don't touch the scale of the sprite. this.game.load.image(Assets.SOME_KEY, 'assets/sprite.png'); this.someSprite = this.game.add.sprite(0, 0, Assets.SOME_KEY); this.someSprite.anchor.set(0.5, 0.5); The aspect ratio of the sprite is only correct when the canvas has the exact dimensions 1920x1080. Otherwise it is deformed either in width or in height, depending on the size of the screen (browser window). The canvas now always has an aspect ratio of 16:9 as wished. Is there more I have to take into consideration?
  3. Hi, I want my game to be always in 16:9 with letterboxing when neccessary. I'm using this code in the very first state: this.game.scale.aspectRatio = 1.77; this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.game.scale.align(true, true); When I now start the game after I resized the browser to a quadratic format the aspect ratio is different, close to 1. As if the aspect ratio I set is just being ignored and the canvas is scaled to the complete window. I'm not in the browser full screen mode. When I start in a format close to 16:9 everything works as expected, thus I guess only at startup something goes wrong. Am I missing something?
  4. Thank your very much @samid737 I implemented it using a particle emitter. Now I wonder how I can get notified about collisions without actually let the player collide with the flames. I check for the collision like this currently on every update: this.game.physics.arcade.collide(this.currentAttack.emitter, this.player.sprite, this.onPlayerHit, null, this); In order to not move the player when colliding with the flames I did this: this.game.physics.arcade.enableBody(this._sprite); this._sprite.body.immovable = true; Now the flames bounce of the player, but I only want to let them pass through it and get the callback triggered.
  5. Hi, I want to visualize the "projectiles" of a flamethrower using a group of sprites. They are moved by body physics of type arcade. Now I'd like to scale the single projectiles up, depending on their position on the x axis or alternatively on their livetime. How would you achieve this without draining the cpu too much? Would you use forEachAlive or some sort of callback? Might it be easier to implement using particles and can I check for collision with particles? What I have so far: execute() { let sprite = this.spriteGroup.getFirstExists(false); if (sprite) { sprite.reset(this._enemy.attackSpawnX, this._enemy.attackSpawnY); sprite.body.velocity.x = -200; setTimeout(this.execute.bind(this), 100); } } I use setTimeout in order to spawn the projectiles asynchonous until the group is empty. greetings