wantafanta

Exclude graphics from Camera Shake

Recommended Posts

I am using the "camera.main.shake()" function

How to do make sure that certain graphics like the UI ignore the shake?

For example if had this box

var newGraphic = this.add.graphics({ lineStyle: { width: 2, color: 0x555555 }, fillStyle: { color: 0xeeeeee } });
var rect = new Phaser.Geom.Rectangle();

rect.width = 500;
rect.height =500;
rect.x = 0;
rect.y = 0;

newGraphic.strokeRectShape(rect);

Thanks

Share this post


Link to post
Share on other sites

Personally, I found that using multiple scenes is a lot more comfortable for many things, like UI elements etc. because it can get messy if your game gets bigger. It kind of sorts it. And also is not affected by the camera of the other screen - as Rich already pointed out.

The only thing is, that you have to get sure the new scene (if your game is bigger than the view) is aligned with the underlying scene.

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.