#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
The Classroom Legacy
A cheater adventure
Status | In development |
Author | TheRolf |
Genre | Adventure |
Tags | 2D, classroom, flash, high-school, legacy, Top Down Adventure |
Languages | English |
More posts
- #8: Mission impossibleApr 25, 2019
- #7: Time to interactApr 15, 2019
- #5: See biggerApr 14, 2019
- #4: Forward and backwardApr 14, 2019
- #3: Show me the wayApr 14, 2019
- #2: Getting caughtApr 13, 2019
- #1: Let's designApr 13, 2019
Leave a comment
Log in with itch.io to leave a comment.