TomLGD

Phaser Arcade Physics Group scaling doesn't work.

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^^

Share this post


Link to post
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;
	},

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.