Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Could someone help me understand 2D movement like in platformers a bit better?

Discussion in 'Scripting' started by JustaDuck97, Oct 12, 2019.

  1. JustaDuck97

    JustaDuck97

    Joined:
    Jul 31, 2019
    Posts:
    45
    I just need some help understanding 2D movement. I've seen a variety of scripts that do 2D movement in different ways and I don't really understand them. I know I'm being broad, but that is because my knowledge is lacking. What ever method you use is appreciated, whether that be just explaining commonly used script or showing me a script and explaining it piece by piece. I know i'm asking a lot from a bunch of internet strangers, so I want you to know I appreciate you taking your time to help a newbie like me, thank you very much in advance.
     
    DylanR2006 likes this.
  2. DylanR2006

    DylanR2006

    Joined:
    Sep 15, 2017
    Posts:
    6
    Hi I have been coding games for about a year and I think this video I made will help you.
     
  3. DylanR2006

    DylanR2006

    Joined:
    Sep 15, 2017
    Posts:
    6
    If you have questions please ask and I will try to answer
     
  4. JustaDuck97

    JustaDuck97

    Joined:
    Jul 31, 2019
    Posts:
    45
    What does Space.Self do?
     
  5. DylanR2006

    DylanR2006

    Joined:
    Sep 15, 2017
    Posts:
    6
    So heres my understanding of it, Space.self Spaces out or moves the player from its transform or position. Space.world moves it to the transform of the world or game. I'm not shure if this is super correct but that's my understanding of it. Ex:
    transform.Rotate(Vector3.up * 0.9 * Time.deltaTime, Space.Self);
     
  6. DylanR2006

    DylanR2006

    Joined:
    Sep 15, 2017
    Posts:
    6