• Content Count

  • Joined

  • Last visited

  1. Pave

    Phaser + NPM + ES6 = this-keyword problems

    At default this references a Phaser.Scene
  2. Pave

    Scalable Game

    @samme wow your plugin is great!👍 1. Question: Unfortunately after setting a min width/height my player can move out of the visible game area. (I want to stop the game from scaling too far down) 2. Question: If I want my game to support 4k resolutions am I fine with scaling everything upwards or should i use: { width: 4096, height: 2160, }
  3. Pave

    Scalable Game

    For better visualisation:
  4. Pave

    Scalable Game

    Hello guys, i'm back with a rather huge question. My game is currently optimized for running in full hd(1920,1080). Now I want it to scale to the users display resolution. In this article I've read that i should use "window.innerWidth * window.devicePixelRatio" to determine the users display size. Now the problem is on how to scale all my sprites to keep the same "size ratio". Because if i increase or decrease the game width/height all object have to scale with it of course. In the mentioned tutorial the guy only scaled it to match the PixelRatio and not to preserve the same sprite-gamewidth/height. Are the velocity I set for my sprites in pixels (e.g. setVelocityY(100)). So do I need to scale the velocity too?
  5. You were correct! Thanks @samme I could solve the problem by subtracting π/2 from the rotation.
  6. Pave

    Question about const's

    WebGL just increases performance of your game. Canvas rendering is the slower option. I have never seen setting this constants manually. I always set them in the "config" variable. var config = { type: Phaser.AUTO, width: 800, height: 600, scene: { preload: preload, create: create, update: update } }; var game = new Phaser.Game(config); The type "Phaser.AUTO" automatically tries to use WebGL, but if the browser doesn't support it it'll fall back to Canvas rendering. If you set the correct type in the config variable i think you can delete the two lines, but maybe a phaser expert knows more than I.
  7. Pave

    Sprite with tile texture

    I think this thread can help you (otherwise just dm the thread creator maybe he can help you):
  8. Pave

    Destroy Sprite manually

    I am very new to phaser 3 but you can add all the sprites to a group and then loop through it and destroy the ones you want.
  9. @samme thanks for the correct link. Now I found the Math function BetweenPoints(). Unfortunately I can't get it to work. Here is part of my code: class Enemy extends Phaser.Physics.Arcade.Sprite { constructor (scene, x,y) { super(scene, x,y); } preUpdate (time, delta) { this.rotateFunc(); } rotateFunc(){ let currentPoint = new Phaser.Geom.Point(this.x,this.y+this.displayHeight/2); let pointToMoveTo = new Phaser.Geom.Point(Player.players.getChildren()[0].x, Player.players.getChildren()[0].y); this.rotation = Phaser.Math.Angle.BetweenPoints(currentPoint, pointToMoveTo); this.arcadePhysics.moveTo(this, Player.players.getChildren()[0].x, Player.players.getChildren()[0].y, 30); } } In this example I want to rotate the enemy sprite to face the player sprite. For the error see the attached video. 2018-09-08 11-48-37_1.mp4
  10. Thanks @Damian Pastorini unfortunately this is just a sprite with animations, supporting only the four directions: UP, LEFT, DOWN and RIGHT. In want to be able to rotate my sprite exactly to a point, so I need to use all 360 degree and not only the four directions.
  11. Thanks for your reply. Unfortunately I can't exactly find the methods you are mentioning in the docs. Can you maybe give me an example? Thanks in advance 👍 Pave
  12. I am trying to move my Arcade Sprite to a specific point (let's say it's (50|15) and the sprite is currently at (300|500)). Therefore I am using the moveTo() function. The movement of the object works but the direction it is facing is completely wrong. So how can I let my sprite rotate to this point? (with a short transition would be very nice)