Hello, dear community! I’m not an experienced developer, so maybe my question is silly.
I’m trying to make a prefab of container. In this container, I want to make a nineslice image.
So my container class looks like this.
class AnswerButton extends Phaser.GameObjects.Container {
constructor(data) {
super(data.scene, data.posX, data.posY);
this.answerBtnImg = data.scene.add.nineslice(
data.posX,
data.posY,
data.texture,
data.frame,
data.sizeX,
data.sizeY,
data.radius);
this.add(this.answerBtnImg);
data.scene.add.existing(this);
}
Then I call in from my games scene like this
const btnAttrib = {
scene: this,
posX: 0,
posY: 0,
texture: 'answerBtn',
frame: 0,
sizeX: 100,
sizeY: 100,
radius: 15,
}
this.answerBtn = new AnswerButton(btnAttrib);
this.answerBtn.x = config.width / 2;
this.answerBtn.y = config.height / 2;
The problem is my nineslice rectangle squashed by y direction, but I expect a nice rectangle 100x100 pixels
In the picture, how the rectangle looks like