#6: Point of views


DevLog #6: Point of views

In the following devlog, there will be less to cover because I am making the map also.

So right now, we were able to control our player with a stationary camera on the scene. What I want to do however is to control all the 4 new characters (previous devlog) in this huge map, so what I need is a way to "switch" between different characters and make the camera follow my current character.

This means that I need to relocate the input system in a more general place. I already had a GameManager so I have decided to cut/paste the code inside my GameManager class. As a consequence, I added a PlayerController field.

To switch between characters I want a button. I created an empty GameObject inside a canvas where i put a vertical layout group and a script with a GameObject field with the button:

The script will search every playable character, then create and personalize the button with their respective PlayerController and sprite:

Furthermore, the camera needs a component to track the current character. I did a very simple script with a private transform field and I used Vector3.Lerp in order to smooth it's position:


With all that said, the result is : (not very smooth with the 10fps of the GIF but it is)

I use the rigidbody velocity for movement but I couldn't not make them not to push each other so I upgraded my code to freeze position.

Thanks for reading,

Hope you enjoyed,

TheRolf

Leave a comment

Log in with itch.io to leave a comment.