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

[Released] 2D Platform Controller

Discussion in 'Assets and Asset Store' started by JohnnyA, Mar 11, 2013.

  1. vidjo

    vidjo

    Joined:
    Sep 8, 2013
    Posts:
    97
    Awesome Johnny! Cant wait to hear about it!
     
  2. Claymore

    Claymore

    Joined:
    Oct 17, 2012
    Posts:
    158
    OK,i sent you a massage with source,im going to wait for your answer. :)
     
  3. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    @JohnnyA I took some inspiration from your mechanic in Sorlo by Two for my current project. I've been using 2d platform controller of course and it's working out great so far. The included moving platform scripts are great starting points for implementing platforming mechanics and the controller parameters are pretty easy to configure to get the feel you desire. Thanks for a nice product and the quick support you have offered me so far!!!
     
  4. mousse

    mousse

    Joined:
    Oct 3, 2013
    Posts:
    27

    I would absolutely support such a thing if it meant getting my hands on a working preview. Maybe a subscription model for alpha/beta access? I'm mostly just worried you will burn out before a release without some financial relief. You keep adding awesome features (which looks amazing), but hopefully it's not getting away from you.
     
  5. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Wow that looks beautiful, good luck!
     
    TheValar likes this.
  6. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    I have a day job, and we are right at the end of a major launch, so time is getting away from me as you say. It will settle down a bit soon, but still its hard to achieve the quality and scope that I want while working full time.

    Rewards tiers will be something like:

    Lite version of product - Full version of Product - Early Access (the previews you want) - Design Input (Choose a feature and I'll add it to the product)​

    Still not sure if it will happen, although sentiment is very positive, will keep every one in the loop.
     
  7. Claymore

    Claymore

    Joined:
    Oct 17, 2012
    Posts:
    158
    Johnny? Did you check out that project?
     
  8. vidjo

    vidjo

    Joined:
    Sep 8, 2013
    Posts:
    97
    Johnny, I think that sounds fantastic! Cant wait to give you some money for your hard work!:)
     
  9. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Please use the support email I supplied. It raises a ticket which gets a proper priority and will usually have a response (if not an answer) in 24 hours.
     
  10. mousse

    mousse

    Joined:
    Oct 3, 2013
    Posts:
    27
    Sounds great JohnnyA, I really hope you go for this funding idea. These tools you've been developing are invaluable to indie devs/hobbyists.
     
  11. lightassassin

    lightassassin

    Joined:
    Mar 29, 2013
    Posts:
    45
    So I just wanted to leave a little teaser here for you....



    Some quick notes relating to 2DPC (you can't see them)
    Single player
    2-4 Player local and network co-op (yep networked 2d platform controller)
    Integrated Attack/Health system
    Mecanim animation system
    Custom AI using state based system
    All NPC/Characters use either standard or custom versions of 2DPC (Enemy Crows use a modified version that flies, Flying monkeys that fly and walk etc...)

    Platforms officially targeted
    Windows / OSX / Linux

    Unofficially tested at *much* lower graphics quality while maintaining cross platform networking (no intents for release atm as it requires not using many features from other assets)
    Android / Windows Phone 8

    I am using a mixed version of 1.7/1.8/1.9 of 2d controller as there were some updates I wanted to try and also some custom fixes from either the forums or myself.

    Fun facts, I am majority solo but my brother does some art as well. Lots of things from the asset store but heavily modified. Finally, originally it was a short project for WP8/Windows 8 store competition last year (I've missed 2 of them)... it is a little more than that now.

    ^_^ Sorry for being so slow/quiet Johnny, it's been a long time coming. Expect a fair bit in the next few weeks, got to start marketing this/trying to influence my way into some console dev too.

    Phew, the heart rate is increasing, getting excited! Need a whole "I'd like to thank Johnny for building an excellent controller" speech to get all teary too =D
     
  12. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Hah, thats a very teasing teaser, I clicked it about five times hoping for a video :)

    Can't wait to see it move, or better yet... PLAY IT!
     
  13. mousse

    mousse

    Joined:
    Oct 3, 2013
    Posts:
    27
    Step 1: Go to kickstarter.com
    Step 2: Refresh page
    Step 3: Go to step 2
     
  14. vidjo

    vidjo

    Joined:
    Sep 8, 2013
    Posts:
    97
    Haha, I cant wait for the kickstarter either. Very eager to send Johnny my money XD
     
  15. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Johnny, I will absolutely support your kickstarter for Platformer Pro.
     
  16. JuicePouch

    JuicePouch

    Joined:
    Sep 17, 2014
    Posts:
    2
    Hi Johnny, big fan of your products. I would very much support a kickstarter for Platformer Pro =D
     
  17. nluckett

    nluckett

    Joined:
    Jul 30, 2014
    Posts:
    14
    Quick question of something Im probably overlooking... If I use the Back & Forth Platform Script on an platform, it works and the platform moves left and right. However, I cant figure out how to get my player to lock in place on it. My player just stays still while the platform slides back and forth under him. I see a Platform Script in the Plugins folder, but Im not sure where it goes. Thanks!
     
  18. mousse

    mousse

    Joined:
    Oct 3, 2013
    Posts:
    27
    The player is parented to the platform when he touches it when that works, so the platform script should go on the platform itself where the collider is. I also cant remember if there is a layer issue here but I don't think so.
     
  19. nluckett

    nluckett

    Joined:
    Jul 30, 2014
    Posts:
    14
    Hmm, I tried attaching it to the platforms I would use and it didnt work. Instead the player just stands there. I looked at the Animator window and while Im on a platform it doesnt play the idle animation and wont let me walk. If I press down though I start to climb down. Hmmmm......
     
  20. nonameu

    nonameu

    Joined:
    Apr 8, 2014
    Posts:
    18
    Figured out. You have to make sure your moving platform and box collider are both at x rotation 0. The player model needs to be on top of the collider, not standing on the sides if you're collider is rotated.
     
    Last edited: Sep 21, 2014
  21. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    @nonameu Glad you figured it out, remember the controller is 2D at heart, so your visuals might be 3D but the collider geometry should be set up as if 2D (i.e only z rotation). Also use the support channels for quick responses from me, I check here, but not frequently.

    - - - -

    As to Platformer Pro, I've booked leave for a week in October. I will be using some of this time to add a bit of stuff here and there and get the kickstarter up and running.

    Also thinking about other options, for example a version of the product which is a complete game including menus, highscores, analytics, etc and is ready for an artist to plug in assets and level design with zero code. I think this is different to the main thrust of the product because it focuses on removing a lot of choices in order to provide a very simple workflow.

    I'm also open to suggestions...
     
    Last edited: Sep 22, 2014
  22. mousse

    mousse

    Joined:
    Oct 3, 2013
    Posts:
    27
    Extremely exciting news Johnny. This made my day in a big way.

    re: game menus etc as stretch goals?

    Whatever gets you excited to work on PPRO again, I'm all for though.
     
  23. Unimatrix

    Unimatrix

    Joined:
    Sep 15, 2014
    Posts:
    8
    Hmm Wall-Slide ist not working for me. I activated Can Wall Slide and Can Wall Jump but with Hero Character2D nothing happens. He just falls down. I checked it with the AnimationLogger2D...nothing. I tested it with the AlienCharacter...nothing, with the normal Raycast Character Controller - no wall slide. All Settings are set to default.
     
  24. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Not sure whats happening with you 3D version as obviously that is working in the samples. However you are right there is a bug in the 2D version where if you don't set a wall tag it never slides as no walls match the empty tag. Crazy how that bug can go unreported for so long.

    Here's the fix:

    Change line 816 of RaycastCharacterController2D from:

    Code (csharp):
    1.  
    2. if (currentWallTag != wall.wallJumpTag) stopWallSlide = true;
    3.  
    To:

    Code (csharp):
    1.  
    2. if (wall.wallJumpTag != null && wall.wallJumpTag != "" && currentWallTag != wall.wallJumpTag) stopWallSlide = true;
    3.  
    That will make slide work on HeroSample2D.

    If you are setting it up on a new character just be careful about the Edge Detection offset, you need to put some values in here (this is what it uses to determine if it should slide or hang or do nothing in a tile based level). Start with the same values as the HeroCharacter2D.
     
  25. Unimatrix

    Unimatrix

    Joined:
    Sep 15, 2014
    Posts:
    8
    Yess now it works!! JohnnyA you are awesome. Thank you.
     
  26. Unimatrix

    Unimatrix

    Joined:
    Sep 15, 2014
    Posts:
    8
    Sorry to bother you again, but i have two Animation Problems (again default settings in HeroSample2D):
    Problem 1: When i am standing next to a wall and press only the opposite arrow key, this is what happens:


    Problem2:

    During a Wall Slide (when i have activated Easy Wall Jump an Jump Only in Opposite) when i hold (accidentally) the left arrow key and press the space bar again and again this happens:

     
    Last edited: Sep 25, 2014
  27. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    1. Is a bug but will need to take a look to work out whats going on, there should be a grounded check there. Can you send request to support channel so I don't forget :)

    2. Was desired behaviour, I like climbing up walls using timed wall jumps.
     
  28. Unimatrix

    Unimatrix

    Joined:
    Sep 15, 2014
    Posts:
    8
    Nevermind, i am using RayCastCharacterController2D with 2D Toolkit now and everything works fine.

    So, it's not a bug, it's a feature? Hmm...not really seeing the advantage here. imho you should make it customizable. I guess i will turn it off. But thanks for your fast reply!
     
  29. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Which part don't you want? Happy to help you tweak as you need.
     
  30. Unimatrix

    Unimatrix

    Joined:
    Sep 15, 2014
    Posts:
    8
    I just found the Opposite Direction Time...:rolleyes:

    Now i'm happy. I hope you release Platformer Pro soon!
     
  31. vidjo

    vidjo

    Joined:
    Sep 8, 2013
    Posts:
    97

    Fantastic to hear about Platformer Pro Kickstarter being put up! As far as another asset with a complete game and menus, highscores, analytics.. well, I personally am not interested in that. I'd prefer you focus on platforming functionality. I need a tool that does one job very well, not a tool that does many jobs with limited functionality.
     
    Unimatrix likes this.
  32. mousse

    mousse

    Joined:
    Oct 3, 2013
    Posts:
    27
    edit: Hmm nm, I think this was my fault.
     
    Last edited: Sep 30, 2014
  33. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Finally put together a promo video for Dracola Dash:

     
  34. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Not much news,but here's a summary:

    - I have posted a request for developers to help with Platformer PRO on my local game dev facebook page and will probably do a similar post here if I can't find someone local.

    - Getting some art done for the kickstarter so it will look a little nicer and hopefully attract more people.
     
  35. lightassassin

    lightassassin

    Joined:
    Mar 29, 2013
    Posts:
    45
    Hmm... I better get my butt into gear with some material to show off then. Moved house now, on sweet NBN 100/40. Already been working on the game for 6 hours today... so much to do =D

    Also, Dracola Dash looks great, is it for personal example? or a clients game? Seems like a good thing to release for Halloween ;)
     
  36. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Sounds good :)

    Dracola Dash is from me (JNA Mobile) it is a collaboration with an artist from the Unity Forum.
     
  37. mousse

    mousse

    Joined:
    Oct 3, 2013
    Posts:
    27
    hey so anyone have any idea why editing the feet colliders wont save positions? It's almost like Unity thinks they aren't serializable all of a sudden. Works in some of my tests and not in others. The collider positions reset every time I hit the play button.
     
  38. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Could you raise a support request so we can work out the issue, haven't had this reported before and I'd like to work out what it is!
     
  39. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    I keep mentioning it but Dracola Dash goes Live (or should I say undead) for iOS from today, please help support JNA Mobile by downloading it:
     
    vidjo likes this.
  40. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Someone was asking about explosions and knock backs, it basically involves two things:

    1. Stun Character.
    2. Change character velocity.

    Here'a quick little script which will do just that, as always way too many configuration options :)


    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class ExplosionSample : MonoBehaviour {
    6.  
    7.     /// <summary>
    8.     /// How long to wait before the explosion goes off.
    9.     /// </summary>
    10.     public float delay = 2.0f;
    11.  
    12.     /// <summary>
    13.     /// How wide is the explosion.
    14.     /// </summary>
    15.     public float radius = 8.0f;
    16.  
    17.     /// <summary>
    18.     /// How much force to apply due to explosion.
    19.     /// </summary>
    20.     public float explosionForce = 5;
    21.  
    22.     /// <summary>
    23.     /// If within explosion range what is minimum time character will be stunned. i.e. time stunned if distance = radius.
    24.     /// </summary>
    25.     public float minStunTime = 0.5f;
    26.  
    27.     /// <summary>
    28.     /// If within explosion range what is maximum time character will be stunned. i.e. time stunned if distance = 0.0f.
    29.     /// </summary>
    30.     public float maxStunTime = 2;
    31.  
    32.     /// <summary>
    33.     /// Generally we want the explosion to blast us up, more than it blasts us back, even though this isn't physucally accurate.
    34.     /// This factor controls the weighting between x and y movement.
    35.     /// </summary>
    36.     public float yFactor = 5.0f;
    37.  
    38.     /// <summary>
    39.     /// It looks better if we slide back from the explosion, so we temporarily lower drag in order to suport this.
    40.     /// </summary>
    41.     public float dragOverride = 2.0f;
    42.  
    43.     // Use this for initialization
    44.     void Start () {
    45.         StartCoroutine (DoExplosion ());
    46.     }
    47.  
    48.     /// <summary>
    49.     /// Wait then explode.
    50.     /// </summary>
    51.     IEnumerator DoExplosion () {
    52.         yield return new WaitForSeconds(delay);
    53.         if (particleEmitter) particleEmitter.Emit ();
    54.         RaycastHit[] hits = Physics.SphereCastAll (transform.position + new Vector3(0, 0, -10), radius, new Vector3 (0, 0, 1), 100);
    55.         foreach (RaycastHit hit in hits) {
    56.             RaycastCharacterController character = hit.collider.GetComponent<RaycastCharacterController>();
    57.             if (character == null && hit.collider.transform.parent) character = hit.collider.transform.parent.GetComponent<RaycastCharacterController>();
    58.             if (character) {
    59.                 float normalDarg = character.movement.drag;
    60.                 float appliedForce = Mathf.Lerp (explosionForce, 0, hit.distance / radius);
    61.                 float stunTime = Mathf.Lerp (maxStunTime, minStunTime, hit.distance / radius);
    62.                 character.Stun(stunTime);
    63.                 character.Velocity = -appliedForce * new Vector2(hit.normal.x, hit.normal.y * yFactor);
    64.                 character.movement.drag = dragOverride;
    65.                 if (character.movement.movementStyle == MovementStyle.DIGITAL) {
    66.                     // If movement style is digital we can't slide or get moved properly by physics
    67.                     // so we temporarily switch to DIGITAL_WITH_SLIDE.
    68.                     character.movement.movementStyle = MovementStyle.DIGITAL_WITH_SLIDE;
    69.                     StartCoroutine(RestoreMovementStyle(character, stunTime));
    70.                 }
    71.                 StartCoroutine(SetDragAfterDelay(character, normalDarg, stunTime));
    72.             }
    73.         }
    74.     }
    75.  
    76.     /// <summary>
    77.     /// Sets the drag after a delay.
    78.     /// </summary>
    79.     IEnumerator SetDragAfterDelay(RaycastCharacterController character, float drag, float delay) {
    80.         yield return new WaitForSeconds(delay);
    81.         character.movement.drag = drag;
    82.     }
    83.  
    84.     /// <summary>
    85.     /// Sets the movement style to digital after a delay.
    86.     /// </summary>
    87.     IEnumerator RestoreMovementStyle(RaycastCharacterController character, float delay) {
    88.         yield return new WaitForSeconds(delay);
    89.         character.movement.movementStyle = MovementStyle.DIGITAL;
    90.     }
    91.  
    92. }
    93.  
    Key area for improvement would be the equation for force (you probably don't want to use linear force based on ratio).

    Attached is a Unity package with it set up, to use:

    1. Create new project
    2. Import 2DPC
    3. Import Unity Standard Assets - Particle Systems
    4. Import this package
    5. Press play and run towards the explosion area.

    And a video:

     

    Attached Files:

    Last edited: Oct 14, 2014
  41. mousse

    mousse

    Joined:
    Oct 3, 2013
    Posts:
    27
    I looked a bit harder and was getting that stupid "missing script on behavior" message, that never tells you WHERE its missing. I ran a bunch of scripts I found online trying to figure out where but I could never find it. Ended up reimporting everything and it works fine now.

    Very strange. I feel like Unity MUST give some kind of name or SOME way to track those errors down, VERRRRY annoying.
     
  42. robinball

    robinball

    Joined:
    Jan 1, 2013
    Posts:
    48
    Hi Johnny.

    I don't know if it's just me, but Dracola Dash doesn't seem to work very well on the ipad Air or the iPhone 5S (both on iOS8). It opens both in portrait mode, but the screen seems to be landscape. So the title screen is cropped down the sides and I can't press the start button as it's between the two screens.

    Thanks
     
  43. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Yup pulled form store until Apple approves my iOS 8 bug fix (well really Unitys bug, but my fault for not testing it, and I thought I was being clever and well prepared by having the app submitted nearly 4 months early).
     
  44. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335
    Hi JohnnyA,

    I saw that V2 will coming. What's up in this new version plz? ( I missed the day of the deal :( )

    Regards,

    T.
     
  45. BioFan

    BioFan

    Joined:
    Mar 4, 2013
    Posts:
    24
    Hi JohnnyA,

    Honestly I got the complete physics platformer kit and just found out about your kit.
    I wonder if I am able to combine the two kits together? :)
    I'm looking for a ledge climbing script, ladder, rope and crouching and your kit has it.

    yes you prob guessed that I'm a newbie and not a programmer...need any code help as much as I can
     
  46. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    @BioFan, that kit is really good too, but it has a very different basis to this one so I don't think combining them is really an option. If your game is 2D and not physics based it might be worth switching to 2DPC, otherwise I would check the forums for the other kit and see what people have pulled together. I'm pretty sure I've seen a ladder sample there.

    Cheers,

    John A
     
  47. BioFan

    BioFan

    Joined:
    Mar 4, 2013
    Posts:
    24
    @JohnnyA my game is actually 2.5D and yours is definitely sufficient. I got the ladder sample from the users in the forum but cos of my limited programming skill, I didn't know how to make it as nice as yours.
    Another question, does the current kit do powerup that you have in platformer PRO? Wonder if I should wait for Platformer PRO actually. If your kit is coming out within this year, I will wait. :) Your kit seems to have everything I need.
     
  48. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    No promises on Platformer PRO release date, definitely not this year.
     
  49. BioFan

    BioFan

    Joined:
    Mar 4, 2013
    Posts:
    24
    thanks @JohnnyA
    quick question, does your kit support mechanim animation?
     
  50. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Yes. For 2D complete sample included. For 3D there is a controller included in the pack but it is marked as beta as it doesn't have all the transitions (it has most of them). Its a solid base to work from but you might need to add some extra states or adjust transitions (generally when you add your own character and animations you need to do this anyway).