I am making a 2p game and would like to know how to code a camera which allows both players to be in the camera at all times. For example it zooming in or out depending on where the players are. Thank you in advance.
howtoconstructdemos.com/auto-zoom-and-scroll-the-screen-to-fit-multiple-characters
thanks but since I have 2 different sprites this does not work well for me. Do you have any ideas for what i should do?
Develop games in your browser. Powerful, performant & highly capable.
With only two objects the code may be even simpler. You don't have to loop through them. You can do this:
Set minX to min(player1.x, player2.x) Set maxX to max(player1.x, player2.x) etc.
Or you can add both sprites to a family.
Oh, interesting. Thanks a lot! I really appreciate it!