Making sven coop player models
So if you have done this and you have moved your player to the edge of the screen you have probably figured out that this is not the most efficient way.Īs your player may be able to go out of the bounds of the screen and so will your camera view. The simplest way to do a camera follow is to just child our camera to our player like this. Simplest player camera follow and movement So dragging that into our unity project we now have. I made this one in inkscape very quickly. Now you should have a moving player when you hit play in unity. Rb.velocity = new Vector2(-moveSpeed*ltaTime,0) Rb.velocity = new Vector2(0, moveSpeed * ltaTime) Rb.velocity = new Vector2(moveSpeed*ltaTime, 0)
Rb.velocity = new Vector2(0, -moveSpeed * ltaTime)
Making sven coop player models update#
Start is called before the first frame update Public class PlayerMovement : MonoBehaviour Replace the code in that script with this. Now go ahead and open up the player movement script in visual studio. Once done let’s create a player movement script.ĭrag and drop that onto your player game object like so. Then change the rigidbod2d settings to be kinematic. Now go ahead and add a rigidbody2d component on the right by clicking on add component. We want to drag our sprite into our scene. So go ahead and right click in our assets folder and create a square sprite with the below steps in the screenshots. We will start off by adding a simple player as a square sprite. To start we create a new unity 2d project. We will then go ahead and add some bounds to our camera so we can limit our camera movement. From there we will put together a unity 2d camera movement which will allow for a top down player camera follow. With this we will just add a basic background so we get some depth in our 2d world. So I will setup a square as our player moving around left, right,up and down. First we need to setup a very basic unity 2d project with a player moving in our scene.