Movement of the character.

Hello
I’m novice in Unity3D, and I have a question concerning the movement 2D objects
I wanted to know is it possible to make the movement of the character, not only in the X, but also along the axis Y? (respectively with the correct texture: face and back view)
And is it possible to increase / decrease the size of the hero when you move up / down?

Here is the script, which is used for character movement along the axis X:

using UnityEngine;
using System.Collections;

public class CharacterControllerScript : MonoBehaviour
{
public float maxSpeed = 10f;
private bool isFacingRight = true;

Animator anim;

void Start()
{
anim = GetComponent();
}

void FixedUpdate()
{
float move = Input.GetAxis(“Horizontal”);

anim.SetFloat(“Speed”, Mathf.Abs(move));

rigidbody2D.velocity = new Vector2(move * maxSpeed, rigidbody2D.velocity.y);

if(move > 0 !isFacingRight)
Flip();
else if (move < 0 isFacingRight)
Flip();
}

void Flip()
{
isFacingRight = !isFacingRight;

Vector3 theScale = transform.localScale;
theScale.x *= -1;

transform.localScale = theScale;
}
}

Also I have a question about camera
Can I put some borders in areas where the camera stop follow the main character, but the character continues to move until you get to another area?

Help, please
I would be glad for any help :sad:


Are you a newbie in Unity3D or overall in creating games?? I see your script is a copy&paste from official video tuts of Unity… not really sure if you do understand what this script does. It works, but do you understand each line? If you do then you could answer to half of your questions at least. What I would suggest you is to follow few tutorials and read about Animations, Scripting.
Answer to all your questions: YES, you can, but before you need to learn and not just do the copy&paste.
A tutorial to complete game with Parallax background, with Animation, Scripting and everything.

Finish that tutorial and you will get answer to all your questions

Thank you
This is really good tutorials but I don’t understand one thing
How can I continue to move when I keeping the player in camera bounds?
Becouse that area is more bigger…


Movement up/down/left/right is the same as you would in 3D, except you don’t use the Z axis.
Camera bounding would be done by making the camera child of the player.