Jump to content

Phaser Arcade Physics Group scaling doesn't work.


TomLGD
 Share

Recommended Posts

Hi!

I want to make a pixel game with a resolution of 144*256 pixels.
I want to keep the pixel look also when I rotate a sprite.
So the player is able to see tilted pixels.

So i decided to set the real dimension of the game to the full available size like 1920*1080.

Then I put everything inside a Group and scale the whole Group up so that the game fits the canvas.

Also I'm using the Arcade physics and there is where the problem takes place.

The physics bodies are not scaled with the group and so the whole szene is useless^^

So is there a solution to scale a whole stage or the "game" up to maximal resolution but working correctly with a design resolution?
The Falsh engine Starling worked like this and that was very handy cause you get the real pixel count of the device without taking care of that.

Thanks in advance^^

Link to comment
Share on other sites

That would set all bodys to the same size. 

so my current solution is this:

all map layers are scaled with:

this.layer.setScale(scaleRatio);

and every added sprite is added to the game this way:

 

addSprite: function(x, y, name) {
		var s = this.getScale();
		var obj = this.add.sprite(x, y, "atlas", name, this.base);
		obj.scale.set(s);
		obj.x *= s;
		obj.y *= s;
		return obj;
	},

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...