Sorry for the really basic question, I just started learning Unity and was trying to make a basic 2D pixel RPG. I haven’t been able to find a good answer for this even though it’s pretty simple.
Basically, at the start of the game I want there to be a “cutscene” of the characters walking into the screen to a specific point, then stopping. They would then have a dialogue box conversation before the user can move around. It’s not going to be a video cutscene, and instead use the character sprites and walking animations I already built into the game.
I think that the probable way to solve this would be to use a script attached to the characters, but I cannot for the life of me figure out how to make the characters walk naturally to the spot.
As a test I used:
myRigidBody.MovePosition(transform.position + new Vector3(0,1,0));
Which only moves the character instantly to a spot on my map.
I also tried something like
myRigidBody.velocity = new Vector2 (0, moveSpeed);
Which does work because my character will move upwards with a walking animation, but she will never stop walking until she hits a collider.
My main questions are these:
-
Is there a way to make the characters walk up, turn and walk right, then stop while still using the walking animations I attached to the sprites? I used a Blend Tree for animations.
-
I am also unsure whether the code should be in start() or update() since it only runs once in the beginning of the game.
Thanks for any help.