wantafanta Posted October 18, 2018 Share Posted October 18, 2018 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 Link to comment Share on other sites More sharing options...
rgk Posted October 19, 2018 Share Posted October 19, 2018 You can use camera ignore and create two cameras, one for the user interface and one for the game. http://labs.phaser.io/edit.html?src=src/camera\ignore.js Or you can use two scenes: http://labs.phaser.io/view.html?src=src\scenes\ui scene.js blackhawx 1 Link to comment Share on other sites More sharing options...
rich Posted October 19, 2018 Share Posted October 19, 2018 Yup, as rgk said. Personally, I'd use two Scenes. Link to comment Share on other sites More sharing options...
wantafanta Posted October 20, 2018 Author Share Posted October 20, 2018 Thank you, these answers were great. Link to comment Share on other sites More sharing options...
s4m_ur4i Posted October 21, 2018 Share Posted October 21, 2018 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. Link to comment Share on other sites More sharing options...
Recommended Posts