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

Unity Tutorial: Creating a Scroller/Platformer Game

Discussion in 'Community Learning & Teaching' started by Random-username, Jun 19, 2013.

  1. el_toro

    el_toro

    Joined:
    Jan 25, 2014
    Posts:
    1
    This is my first post here and really wanted to use it to thank you for your great tutorials.

    Like a few others have mentioned I'd be very eager to see how you would approach ledge hanging and ledge climbing.

    Cheers!
     
  2. Cartridge

    Cartridge

    Joined:
    Feb 13, 2014
    Posts:
    1
    Amazing tutorials!!! Thank you so much! I subscribed for your youtube channel as well, keep up the good work!

    I had one question though... running into a little problem even though i think i followed all of your instructions correctly:

    My Speed parameters never go into negative when I walk/run, so it seems as if my "player is kind of moonwalking when i try walking Right.
    WHAT CAN I DO TO FIX IT???? PLEASE HELP THANK YOU IN ADVANCE!

    // Face Direction
    float moveDir = Input.GetAxisRaw("Horizontal");
    if (moveDir !=0) {
    transform.eulerAngles = (moveDir>0)?Vector3.up * 180:Vector3.zero;
     
  3. DLefort

    DLefort

    Joined:
    Mar 8, 2013
    Posts:
    2
    Anyone was successful in making slopes work? I've been trying for more than a week now and I'm starting to get desperate.... Help, anyone?
     
  4. Rubber Bounce

    Rubber Bounce

    Joined:
    Oct 11, 2013
    Posts:
    55
    This isn't going to work for slopes as the character "collider" (i know it's raycasting and not really a collider) is in theory a box, thus any angle the character face, will stuck it, if you however do a complete remake of the physics using character controller and a capsule or ball collider, slopes will not be an issue. I am sorry...

    $Meh.png
     
    Last edited: Feb 28, 2014
  5. annamaia

    annamaia

    Joined:
    Mar 5, 2014
    Posts:
    1
    Can we get the project files for this anywhere?
    It helps me learn faster if I have access to the already-made project, as far as checking back coding and etc. Rewatching the videos to check back on everything (and to re-do some parts on my own project, that I have made a mistake on and need assistance) is getting a bit confusing.
     
  6. KageJason

    KageJason

    Joined:
    Dec 10, 2013
    Posts:
    2
    I am having troubles with some of the code. Part 1.

    Assets/Scripts/PlayerController.cs(29,29): error CS1525: Unexpected symbol `playerPhysics'


    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. [RequireComponent(typeof(PlayerPhysics))]
    5. public class PlayerController : MonoBehaviour {
    6.  
    7.  
    8.     //Player Handling
    9.     public float speed = 8;
    10.     public float acceleration = 12;
    11.  
    12.     private float currentSpeed;
    13.     private float targetSpeed;
    14.     private Vector2 amountToMove;
    15.  
    16.     private PlayerPhysics playerPhysics;
    17.  
    18.     // Use this for initialization
    19.     void Start () {
    20.         playerPhysics = GetComponent<PlayerPhysics> ();
    21.     }
    22.    
    23.     // Update is called once per frame
    24.     void Update () {
    25.         targetSpeed = Input.GetAxisRaw ("Horozontal") * speed;
    26.         currentSpeed = IncrementTowards (currentSpeed, targetSpeed, acceleration);
    27.  
    28.         amountToMove = new Vector2(currentSpeed,0)
    29.         playerPhysics.Move(amountToMove * Time.deltaTime);
    30.    
    31.     }
    32.    
    33.     //Increase n toward target speed
    34.     private float IncrementTowards(float n, float target, float a) {
    35.                 if (n == target) {
    36.                         return n;
    37.                 } else {
    38.                         float dir = Mathf.Sign (target - n);
    39.                         n += a * Time.deltaTime * dir;
    40.                         return (dir == Mathf.Sign (target - n))? n : target;
    41.                 }
    42.         }
    43. }
    44.  

    I honestly have absolutely NO idea what is wrong
     
  7. doodads

    doodads

    Joined:
    Mar 10, 2014
    Posts:
    1
    you don't have a ; at the end of line 28 in your code.
     
    Last edited: Mar 11, 2014
  8. dantewow

    dantewow

    Joined:
    Mar 16, 2014
    Posts:
    1
    Your Face Direction and Input codes should look like this:
     
  9. JaeHyoung

    JaeHyoung

    Joined:
    Apr 19, 2014
    Posts:
    1
    Thank you!!;);)
     
  10. TPawnzer

    TPawnzer

    Joined:
    May 6, 2013
    Posts:
    55
    Wonderful tutorials series :)
     
  11. Mr_Manza

    Mr_Manza

    Joined:
    Jun 22, 2014
    Posts:
    3
    ok I can't figure how to get this code to post so I am just posting a link please help I have re done this at least 20 times and I just don't understand..I get no movement at all when i hit play now it says there are these errors and I can't seem to fix them, plus it says the script and file class name do not match but they do

    Warning CS0108: `PlayerPhysics.collider' hides inherited member `UnityEngine.Component.collider'. Use the new keyword if hiding was intended (CS0108) (Assembly-CSharp)

    The type `UnityEngine.Vector2' does not contain a constructor that takes `1' arguments (CS1729) (Assembly-CSharp)

    An object reference is required to access non-static member `UnityEngine.Ray.origin' (CS0120) (Assembly-CSharp)

    these are the errors I get here is my script but it should be line for line with the script at the end of the 1st vid
     

    Attached Files:

  12. Raivel

    Raivel

    Joined:
    Jun 26, 2014
    Posts:
    1
    Your problems are from the PlayerPhysics.cs file.
    Line 40 you need to add an X file of 0 so it's new Vector2(0, dir).
    Line 44 you need to make the Ray.origin lowercase so it's ray.origin.
     
  13. Mr_Manza

    Mr_Manza

    Joined:
    Jun 22, 2014
    Posts:
    3
    thanks, hey can I ask you how to fix the rid in sprite editor? its always just little blocks for me the grid is never the right size
     
  14. Jeffo

    Jeffo

    Joined:
    Sep 11, 2013
    Posts:
    13
    Hi Sebastian,

    Just wanted to chime in and say what a fantastic tutorial you put together so far.

    I just started on a platformer prototype and this was a tremendous boost to get going. I hope you continue the series!

    Can't wait for more :)

    Jeff
     
  15. Zorranco

    Zorranco

    Joined:
    Jul 15, 2014
    Posts:
    23
    Hallo.

    Good tutorial, except newer versions of blender crash when trying to import :(
     
    Last edited: Jul 18, 2014
  16. voanerges

    voanerges

    Joined:
    Aug 18, 2014
    Posts:
    3
    hello ! I have a question how to make a character walk on the oblique surface can follow any responses to give an example of code. thanks example.PNG
     
  17. Sir Burnman

    Sir Burnman

    Joined:
    Aug 26, 2015
    Posts:
    1
    Just started my first game and your tutorials are just what I'm looking for. I will follow your steps to a T, I'll update you on my progress when i have completed all the steps.
     
  18. SebastianLague

    SebastianLague

    Joined:
    Aug 31, 2014
    Posts:
    111