Search Unity

[WIP] Custom 2D Character Controller (+switching to C#)

Discussion in 'Works In Progress - Archive' started by aeth_dz, Nov 24, 2013.

  1. aeth_dz

    aeth_dz

    Joined:
    Jul 3, 2012
    Posts:
    29
    Hello,
    my name is David, and I'm the founder of BatzStudio, and maker of QubeFlip .

    Since the Unity3D 4.3 has come out with all 2D tools, I've decided to make a custom 2D Character Controller for my upcoming game (heavily inspired by Tomba series, Mark of the Ninja and similar), and also, to use that project to finally start using C# for coding in Unity3D.

    Although there are some great controller scripts available, I'll do my best to write my own.
    First goals, to hopefully implement in this week are:

    • Basic side-scroller, left and right movement
    • Jumping and double jumping
    • Climbing certain objects
    • "Ledge-hanging"
    • Different behaviour on different surfaces
    • Different behaviour on different surfaces

    I'll post all my progress here.

    Cheers :)
     
  2. aeth_dz

    aeth_dz

    Joined:
    Jul 3, 2012
    Posts:
    29
    Small demo:

    http://batzstudio.com/unity/platformer/platformer001.html

    still very rough.

    Finished (kinda):

    • Walking/running
    • Jumping and double jumping
    • Hanging on a ledges (presented as pink dots in the demo)
    • Jumping from hanging (Space, and direction)
    • Dropping down form hanging (press S)
    • Movable obstacles ( main problem was to keep player "attached" to them, solved it by making the player child of the object)
    • Adjusting players rotation according to surface below


    Remaining for this week:

    • Climbing (ladders, ropes etc)
    • Jump from climbing
    • Different behavior on different surfaces (ice, water, sticky etc)
    • Character mesh ROTATION :D

    Also, I've found that character sometimes gets stuck on the ground, although quite rarely, it's annoying, so I'll try to fix that too.

    Note: current player mesh is only a placeholder, and it's not related Kif Kroker :p
     
    Last edited: Nov 25, 2013
  3. order66

    order66

    Joined:
    Apr 17, 2012
    Posts:
    150
    The movement seems kind of jittery to me.

    And you can hang on the side of the blocks, which seems kinda strange.

    Nonetheless a good start, but needs some work! Good luck with that!
     
  4. GeneBox

    GeneBox

    Joined:
    Nov 15, 2012
    Posts:
    480
    Looks good but yeah it does feel jittery just a little it, especially while jumping.
     
  5. aeth_dz

    aeth_dz

    Joined:
    Jul 3, 2012
    Posts:
    29
    Thanks for checking out.
    The "jittery" thing is probably due physics calculations in "FixedUpdate" because the current mesh is directly a child of the controller, just like a placeholder for proper model. The true model will have some kind of interpolation when following the controller. +I'll try to work out better script for camera.

    @order66 - Do you mean hanging on a "pink dots" ? or some kind of bug? That with the pink dots is like, when a character falls of the roof, and grabs/hangs on the ledge.. In this demo it's an overkill though, but I have an idea for a future game based on this controller, so I've implemented it :D
     
  6. aeth_dz

    aeth_dz

    Joined:
    Jul 3, 2012
    Posts:
    29
    Here is the new update:

    http://batzstudio.com/Web0003/Web0003.html

    I've fixed the camera issue, it now follows player quite smoothly.
    Also here is the list of improvements:
    -Different behavior on different surfaces (ice, mud, steps etc.)
    -Crouching/crawling (still plenty room for improvement)
    -Bit more natural "hanging trigger"
    -Dashing (while holding shift, not available on mud and ice)
    -Added trail renderer to player, so i can track the look of jumping "curve"
    -Hanging / "hand walking" on the rail/rope

    Task for this week:

    -Improve crouching, add sliding function too
    -FINALLY make proper climbing/wall jump
    -Enable interaction with physics enabled objects (boxes, balls, seesaws etc.)
     
  7. Kaji-Atsushi

    Kaji-Atsushi

    Joined:
    Oct 6, 2012
    Posts:
    234
    Good work so far!, it plays nicely.
     
  8. DanielUDI

    DanielUDI

    Joined:
    Nov 27, 2013
    Posts:
    4
    Thanks, i need it!! :D i'm waiting
     
  9. aeth_dz

    aeth_dz

    Joined:
    Jul 3, 2012
    Posts:
    29
    Thank you guys!
    More updates coming soon..
     
  10. DanielUDI

    DanielUDI

    Joined:
    Nov 27, 2013
    Posts:
    4
    more updates?
     
  11. Gale

    Gale

    Joined:
    Jun 22, 2012
    Posts:
    40
    I'm curious as well if there is going to be any kind of updates or release for this. It looks really well made and it would be perfect for some of the stuff I've been working on.
     
  12. aeth_dz

    aeth_dz

    Joined:
    Jul 3, 2012
    Posts:
    29
    Sorry for a delay, I had some other projects to finish, so I wasn't able to make any updates util few days ago.
    Anyway, I rewrote the whole controller.

    You can check the progress here (also there is a playable demo).

    Once again, sorry for the delay. From now on, this is pretty much my main project, so updates will be available probably every week.

    Cheers!
     
  13. aeth_dz

    aeth_dz

    Joined:
    Jul 3, 2012
    Posts:
    29
    Here is the update for my platformer controller for Unity engine.

    http://devlog.batzstudio.com/platformer-demo02/

    Here is the list of changes :

    - added checkpoint system
    - added different surface types (hard/soft, slippery/normal/sticky)
    - added breakable tiles
    - added a slight bounce when landing on hard surfaces from the long fall (later, this will reduce players health)
    - player can now jump off any wall
    - player can jump off when moving on horizontal poles/pipes/ropes
    - camera now adjust according to players speed and direction, for example when player is sprinting, camera will reveal larger portion of the level ahead of the player, allowing him better reaction

    Please comment and critique!

    P.S. please note that this is not a proper level, I’ve only made this to test various gameplay elements