wclarkson

Members
  • Content Count

    11
  • Joined

  • Last visited

About wclarkson

  • Rank
    Member

Contact Methods

  • Website URL
    phasergames.com

Profile Information

  • Gender
    Male
  • Location
    Thailand

Recent Profile Visitors

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

  1. wclarkson

    Rounded Rectangle

    Yes, I did see that turn up the other day on something. Great that it was added.
  2. wclarkson

    Positioning GameObjects on an auto scale game

    I agree with Antriel about placing thing relative. This is the method I'm using https://phasergames.com/scaling-games-in-phaser-3/
  3. wclarkson

    Rounded Rectangle

    Thanks! Yeah, it does seem like quite a bit for what used to be one line of code. I will take your function and try to adapt it to what I was doing. I wound up using a rectangle with two circles of the same color in the end to make a pill button.
  4. wclarkson

    Help with simple code with ES6 and phaser 3

    I wouldn't try importing the Phaser library. Just link it in the HTML file and you'll be good to go.
  5. wclarkson

    Help with accessing a containers children

    Log out your container to the console this.input.on('pointerdown', function(container){ console.log(container); }); That will give you a list of all the properties and children.
  6. wclarkson

    Help with accessing a containers children

    What you are looking for is container.list[0] and container.list.length. It is a bit confusing as so many other things use children.
  7. wclarkson

    Rounded Rectangle

    I'm finding the graphics examples very impressive, but it is the simple things that are tripping me up. I know I must be missing something simple, but is there a simple way to draw a rounded rectangle in Phaser 3?
  8. wclarkson

    Container Height and Width

    Hi, Yeah I found setting the .width does nothing as well. However, in the code example above I am setting the displayWidth of the container. This is my console.log of a class that extends container. Changing it will alter the width of the container. Grid {_events: r, _eventsCount: 0, scene: SceneMain, type: "Container", parentContainer: null, …} active:true alpha:(...) alphaBottomLeft:(...) alphaBottomRight:(...) alphaTopLeft:(...) alphaTopRight:(...) angle:(...) blendMode:(...) body:null cameraFilter:0 data:null depth:(...) displayHeight:(...) displayOriginX:(...) displayOriginY:(...) displayWidth:240 Thanks for the links on the width vs displayWidth. Still wrapping my head around it.
  9. wclarkson

    Container Height and Width

    It makes more sense now that you explain it. I'm just so used to having height and width so readily available on all objects. Can you tell me what is the difference between width and displayWidth?
  10. wclarkson

    Container Height and Width

    5 hours after posting this, trying to Google the answer, and all I'm getting is my own question.... Anyway here is what I came up with for a class that extends container overwriting the built-in height and width. I can read width and height but can set it, I can, however, scale to the game's width init() { this.setSize(this.getBounds().width, this.getBounds().height); } get width() { return this.getBounds().width; } get height() { return this.getBounds().height; } scaleToGameW(per) { if (this.displayWidth == 0 || this.displayHeight == 0) { this.init(); } this.displayWidth = game.config.width * per; this.scaleY = this.scaleX; this.init(); }
  11. wclarkson

    Container Height and Width

    In Phaser 2 I will often add things to a group, and then scale that based on the game's width myGroup.width=game.width*.9; myGroup.scale.y=myGroup.scale.x; This has worked very well for me. Phaser 3 groups and containers don't seem to work the same way. I can't get or set the width of a container. I did find a workaround by getting the children that were most to the top, left, right and bottom and calculating a bounding box. I think I can scale it to a percentage of the canvas width by getting an initial canvas width to the calculated width ratio. But... it seems like a lot of work for what used to be 2 lines of code. Am I missing something??