Currently I have a nice arena for my 2D shooter, the arena is about 3 times the size of the viewport, so when the player is in the middle of the arena they will be in the center of the viewport, but as they move to the edge of the layout, the viewport will stop scrolling and the player can move to the side of the viewport.
I really like this effect and it's how I want my game to work, but the problem is that the camera shake function does not work when the viewport is pressed up against the edge of the layout like that, and the camera shake function is pretty important for what I'm trying to do. I know you can unconstrain the viewport, or increase the layout size, but that means that the player is always in the center of the viewport which is not what I want.
I'm sure this is a problem that lots of people have run into, so I really hope there's a solution as the camera shake function is really great apart from that.
Thanks for any help!
Develop games in your browser. Powerful, performant & highly capable.
I've sort of solved it. At least for my purposes.
Use ScrollTo to lock the camera onto an invisible object which you can then either pin to the player using the 'rope' method, or use a distance calculator to get it to chase the player when the player is about to leave the viewport area.
This means that you can have a large border around your playing area which allows the shake to work, but still maximise the amount of the area that the player can see at any time.