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] Corgi Engine - Complete 2D/2.5D Platformer [new v8.0 : advanced damage system]

Discussion in 'Assets and Asset Store' started by reuno, Dec 18, 2014.

  1. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @addz92 > You can use the SaveLoadManager class for that (or implement your own save mechanics if you prefer). You can learn more about it in the documentation.
    Alternatively storing that in the inventory is also a valid approach.
     
    addz92 likes this.
  2. addz92

    addz92

    Joined:
    Mar 4, 2015
    Posts:
    19
  3. kurt11205

    kurt11205

    Joined:
    Jan 15, 2018
    Posts:
    3
    Hi, I tried to download the latest version(v5.4) in the Unity editor and import the asset today, but the version I downloaded is v5.1 no matter how many times I tried, and there is no update option, I wonder why?
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
  5. kurt11205

    kurt11205

    Joined:
    Jan 15, 2018
    Posts:
    3
  6. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    22
    let me know if you figure this out. I have been trying figure out a way to have my ability script to persist as well. Just can't figure it out!
    let me know if you figure this out. I have been trying figure out a way to have my ability script to persist as well. Just can't figure it out!
     
  7. Legionghost

    Legionghost

    Joined:
    Nov 30, 2018
    Posts:
    16
    @Quinn221 I've also had this issue, but I think I figured it out. I haven't tested it when you load a different scene, but it does work when the player dies and respawns. Not sure if it's the correct way but it works.
    I add this script to the powerup sprite/collider. (I use another script to remove the powerup when collided.)

    Enable the ability on the character but disable its 'Ability Permitted' checkbox.
    Replace 'Glide' in the code with the ability you want to activate.

    Code (CSharp):
    1. using MoreMountains.CorgiEngine;
    2. using MoreMountains.Tools;
    3. using UnityEngine;
    4.  
    5. public class EnableGlide : MonoBehaviour
    6. {
    7.     protected CorgiController controller;
    8.     protected CharacterGlide characterGlide;
    9.  
    10.      void OnTriggerEnter2D(Collider2D collider)
    11.     {
    12.         controller = collider.GetComponent<CorgiController>();
    13.  
    14.         characterGlide = controller.gameObject.GetComponentNoAlloc<CharacterGlide>();
    15.         characterGlide.PermitAbility(true);
    16.     }
    17. }
     
  8. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    22
    That is sort of what I did, but it will not keep its persistance when you leave the scene. I need to figure out a way to make it work with the SaveLoadManager.

    Here is what I did

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    namespace MoreMountains.CorgiEngine
    {
    public class Jetpack_Pickup : PickableItem
    {

    protected override void Pick()
    {
    _collider.GetComponent<CharacterJetpack>().AbilityPermitted = true;

    base.Pick();

    }
    }
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @Quinn221 > To have an ability persist across scenes, the best way is to create a new class, let's say AbilityProgressManager. You can look at the RetroProgressManager class for reference.
    What this class will do is, when exiting a scene, save (to a file, using the SaveLoadManager) a status for each of your abilities (or just the ones you think will change state), and on Start, load that file, and modify the character's abilities to enable/disable them according to the saved state.
    There are of course many other ways to do it, using a persistent manager across scenes, or even extending Character or creating a dedicated ability for that.
     
    Quinn221 likes this.
  10. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    22
    Thanks this helps!
     
  11. lsflet

    lsflet

    Joined:
    Aug 15, 2014
    Posts:
    6
    Hi I got few questions on implement my character
    - How can disable player input and revert ? For example when player is getting hit to become stun or during a story event. Is it have a specific prepared function? If not , are there a list of things I need to disable to achieve it?
    - When I doing a melee attack which make a damage area box in front of my character, if another collision enter like a bullet or another character self collision box, my character will be flipped. Is there any idea/ solution for it?

    Thanks for help.
     
  12. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @lsflet > Each ability can be enabled and disabled independtly. I recommend using the AbilityPermitted attribute.
    As for the character flip, I'm not sure I understand the use case. If you want your character to flip, you can use the Flip method. If however you're saying that your character is flipping when it shouldn't, please use the support email to explain the situation and how I can reproduce the problem.
     
  13. adam-goodchild-omobile

    adam-goodchild-omobile

    Joined:
    Jan 12, 2017
    Posts:
    13
    @reuno Hey, I am having an issue with weapons and the characters animator. The "ownerAnimator" variable within the Weapon script it set via the SetOwner method, but this method is called before the CharacterAnimator variable is set within the CharacterHandleWeapon class, and therefore the InitialWeapon never gets its animator set correctly. I can work around it for now, but I am trying to not edit any of the Corgi Engine scripts. I assume the InitialWeapon code just needs to be moved to the end of the Setup method within CharacterHandleWeapon?
     
  14. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @adam-goodchild-omobile > I'm not sure I understand how to reproduce the issue here. Please use the support email to report bugs, and provide steps to reproduce, thanks!
     
  15. adam-goodchild-omobile

    adam-goodchild-omobile

    Joined:
    Jan 12, 2017
    Posts:
    13
    Ok I have emailed via your website, cannot find a support email anywhere.
     
  16. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @adam-goodchild-omobile > Thanks! That's actually the right place to send support requests :)
    I'll have a deeper look at this later today and I'll get back to you.
     
  17. adam-goodchild-omobile

    adam-goodchild-omobile

    Joined:
    Jan 12, 2017
    Posts:
    13
    Thanks @reuno I appreciate the support. It is a simple fix luckily.
     
  18. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
  19. adam-goodchild-omobile

    adam-goodchild-omobile

    Joined:
    Jan 12, 2017
    Posts:
    13
    Of course, thanks again!
     
    reuno likes this.
  20. Subzeroblack68

    Subzeroblack68

    Joined:
    Apr 3, 2014
    Posts:
    19
    Thanks for making such an awesome engine. I just purchased this but have a simple question to see if this is built into the system already.

    I know a basic attack and combo system is built in by repeatedly pressing the same button within a time-frame, but is there already a check for multiple inputs to change the attack for example
    [attack button] = basic attack
    → + [attack button] = forward attack/secondary attack

    Shouldnt be to hard to make but if its already there somewhere in the engine I would rather just use that
     
  21. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @Subzeroblack68 > No, there's no such system built-in.
    But it'd be quite easy to implement with all the systems already in place.
    I'd suggest creating one weapon per attack, and extend CharacterHandleWeapon into a new class in which you could define a different input for each of your attacks. You can look at CharacterHandleSecondaryWeapon for that, it's exactly the same logic (with different input).
     
  22. Reactorcore3

    Reactorcore3

    Joined:
    Nov 27, 2018
    Posts:
    17
    1. Yeah, I suppose so. I was more wanting to know if there was a general ballpark I should aim for and if there are any hidden optimization features like:
    • hiding/disabling sprites that are not visible in the camera view
    • AI characters/elevators becoming disabled/simplified if they're beyond a certain range from the player
    • colliders/platforms turning off if they're beyond a specific distance
    I'll probably need to do so stress testing / trial and error testing to find the limits, but I was wondering if there were any magical built-in systems that did some type of optimization work that I should be aware of and be careful not to overstep them by making my level too wide or too tall.

    2. Thank you. I was initially thinking if there was some MacGyver way to use the melee weapon system for lasers, but having a purpose built laser projectile system would be superior.

    3. Thanks, this is helpful. I will look to find the method.


    P.S. Thank you for 5.4 coming with character swap abilities (and ziplines)! Much appreciated! : D
     
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @Reactorcore3 > No, there are no such features, that's usually something you do on a per-game basis, there are no general rules. You can see a full list of features on the asset's website. If it's not listed, it's not in the engine.
     
    Reactorcore3 likes this.
  24. PaulAfello

    PaulAfello

    Joined:
    Sep 19, 2015
    Posts:
    16
    Hi!

    I am doing a small prototype in which the player respawns forward after several failed attempts of crossing a river. I am going for a somewhat more grounded character so I had to tweak the initial Corgi character setup down quite a bit. No big jumps or insane running speeds in this case. Only thing I have not been able to get rid of is when the character hits an instant death collider from above she bounces up into the air like a basketball. The collision is set to "is trigger" so she should be going through the collider/trigger. Only way I have been able to eliminate this behaviour is by setting the Gravity Ascent Multiplier to zero but this also kills any jumping ability. So I am starting to wonder if this upward thrust upon death is a designed behaviour within the corgi engine? See video for reference:

    https://www.dropbox.com/s/k69h2co8n50k6ep/Prototype_DelayedForwardSpawn.mov?dl=0
     
  25. Legionghost

    Legionghost

    Joined:
    Nov 30, 2018
    Posts:
    16
    I think you can just set the Death Forces to x 0,y 0 in the character's Health component.
     
  26. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    22
    Set death
    Set death force to 0 in your character heath script
     

    Attached Files:

  27. PaulAfello

    PaulAfello

    Joined:
    Sep 19, 2015
    Posts:
    16
    Thank you @Legionghost & @Quinn221 !

    That was not a component where I would have expected such a setting... I feel a bit stupid for not looking there :oops:
     
    Legionghost likes this.
  28. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    22
    Just a bit of advise.. if you want to extend and add in extra stuff, you will need to learn how too basic code. Go to https://www.udemy.com/ search for unity2d and they have several great 2d platform courses. Then come back to Corgi and things will be much clearer. It will be worth it...trust me. Once you learn the basics you will be able to do just about anything in the Corgi. You can easily finish a few courses in a week. (Depending on hoe committed you are)
     
  29. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    22
    I know I have seen people ask about a random item drop for when an enemy dies. Here is a script I created that will do a random item drop. Just add this to your enemy death effect prefab, then drag in the items you want to drop, then fill in the drop rate ( I set it to 15 by default if you want the success drop rate higher increase the number in the inspector ... for testing set it to 100).

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class ItemDrop : MonoBehaviour
    6.  
    7. {
    8.     public GameObject[] itemDrops;
    9.     public int dropSucessRate = 15;
    10.     public Vector3 SpawnDestination;
    11.  
    12.     // Start is called before the first frame update
    13.     void Start()
    14.     {
    15.         int randomChance = Random.Range(0, 100);
    16.  
    17.         if(randomChance < dropSucessRate)
    18.         {
    19.             int randomPick = Random.Range(0, itemDrops.Length);
    20.             Instantiate(itemDrops[randomPick], transform.position + SpawnDestination, transform.rotation);
    21.         }
    22.  
    23.     }
    24.  
    25. }
     

    Attached Files:

    luigi7, Muppo and Boom_Shaka like this.
  30. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    nominated for Github repository
     
    reuno likes this.
  31. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    Thanks for the tip - they have a big sale going on right now for $11.99 a course. Picked up a couple of courses to fill out my knowledge gap and to help with more advanced concepts.
     
  32. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    22
    @Boom_Shaka I highly recommend these three
    Do them in this order:
    Create a Space Shoot 'Em Up With Unity
    Learn To Code By Making a 2D Platformer in Unity
    Unity & C# - Build A Complete 2D Mobile Platformer Game

    If you learn the concepts in these three you will be able to do pretty much anything you want in the Corgi.
     
    Boom_Shaka likes this.
  33. Reactorcore3

    Reactorcore3

    Joined:
    Nov 27, 2018
    Posts:
    17
    Thank you, this gives me clarity.
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @PaulAfello > As @Legionghost & @Quinn221 have already said, that's defined in the Health component. The Health component is responsible, among other things, of characters' death, so it made sense to put that setting here.
    @Quinn221 > Thanks for sharing this!
     
    PaulAfello likes this.
  35. DavidMBradbury

    DavidMBradbury

    Joined:
    Nov 18, 2012
    Posts:
    9
    Heya, was looking at merging the jump and jetpack behavior - After reaching the top of a jump / your velocity nears 0, start the jetpack. Would you recommend modifying the jump / jetpack scripts directly or do you think it'd cause less problems to just create a new ability?
     
  36. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @DavidMBradbury > I'd recommend creating a new ability, easier and cleaner.
     
    DavidMBradbury likes this.
  37. Pacaworks

    Pacaworks

    Joined:
    Jan 28, 2016
    Posts:
    12
    Quick question:

    I'm trying to remap the Dash input for joysticks to Right Trigger (3rd or 6th axis). I basically duplicated the Dash input and added the ShootAxis settings.
    Apparently seems to only work with buttons, am I right? if I am right, there's no other way to handle it rather than extend the InputManager and support a DashAxis input?


    Thanks for your attention! :)
     
  38. DavidMBradbury

    DavidMBradbury

    Joined:
    Nov 18, 2012
    Posts:
    9
    Alright, done - In case anyone wants the code here it is! We're using it to simulate a sort of "struggle jump" (on this cute guy) but I imagine there are quite a few use cases. If you find use for it reuno, feel free to take it.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using MoreMountains.Tools;
    4.  
    5. namespace MoreMountains.CorgiEngine // you might want to use your own namespace here
    6. {
    7.     /// <summary>
    8.     /// Add this to seamlessly transition from jump to jetpack at the top of a jump
    9.     /// </summary>
    10.     [AddComponentMenu("Corgi Engine/Character/Abilities/JumpToJetpack")]
    11.     [RequireComponent(typeof(CharacterJetpack))]
    12.     public class JumpToJetpack : CharacterAbility
    13.     {
    14.         /// This method is only used to display a helpbox text
    15.         /// at the beginning of the ability's inspector
    16.         public override string HelpBoxText() { return "This component implements a transition from jump to jetpack using the jump button. Requires the <b>CharacterJetpack</b> component and uses the jump state. Sounds trigger at the apex of the jump [Start] and will continue [In Progress] until you hit the ground [Stop]."; }
    17.  
    18.         protected CharacterJetpack _characterJetpack;
    19.         protected bool _hitApex = false;
    20.         protected bool _abilityStart = false;
    21.  
    22.         /// <summary>
    23.         /// Here you should initialize our parameters
    24.         /// </summary>
    25.         protected override void Initialization()
    26.         {
    27.             base.Initialization();
    28.             _characterJetpack = transform.GetComponent<CharacterJetpack>();
    29.         }
    30.  
    31.         /// <summary>
    32.         /// Every frame, we check if we've hit the high point or are grounded
    33.         /// </summary>
    34.         public override void ProcessAbility()
    35.         {
    36.             base.ProcessAbility();
    37.  
    38.             if (_controller.State.IsJumping && _controller.Speed.y < 0)
    39.             {
    40.                 _hitApex = true;
    41.             }
    42.  
    43.             if (_controller.State.IsGrounded && _hitApex)
    44.             {
    45.                 _hitApex = false;
    46.                 StopAbilityUsedSfx();
    47.                 PlayAbilityStopSfx();
    48.             }
    49.         }
    50.  
    51.         /// <summary>
    52.         /// Called at the start of the ability's cycle, this is where you'll check for input
    53.         /// </summary>
    54.         protected override void HandleInput()
    55.         {          
    56.             if (_hitApex)
    57.             {
    58.                 if (_inputManager.JumpButton.State.CurrentState == MMInput.ButtonStates.ButtonPressed)
    59.                 {
    60.                     _characterJetpack.JetpackStart();
    61.  
    62.                     if (!_abilityStart)
    63.                     {
    64.                         _abilityStart = true;
    65.                         PlayAbilityStartSfx();
    66.                         PlayAbilityUsedSfx();
    67.                     }
    68.                 }
    69.                 if (_inputManager.JumpButton.State.CurrentState == MMInput.ButtonStates.ButtonUp)
    70.                 {
    71.                     _characterJetpack.JetpackStop();
    72.                     _abilityStart = false;
    73.                 }
    74.             }
    75.         }
    76.     }
    77. }
     
    Betzalel, Quinn221 and Boom_Shaka like this.
  39. Ajhound

    Ajhound

    Joined:
    Oct 6, 2018
    Posts:
    5
    OK I managed to duplicate the coin.cs and all the coding in the scripts relating to adding points to have them as adding gems, so two point scoring separately on the screen. pic of script shows what i did, i just changed all the names in guiManager and gamemanager etc ie MMEventListener<CorgiEnginePointsEvent> to MMEventListener<CorgiEngineGemsEvent> , PointsToAdd to GemsToAdd etc but my question is now what code would it be to when the score from the coin script => 1000 zeros out and adds a gem? thanks
    upload_2019-3-2_20-39-20.png
     

    Attached Files:

    Quinn221 likes this.
  40. Ajhound

    Ajhound

    Joined:
    Oct 6, 2018
    Posts:
    5

    just did that now $194 course for $11 Ive seen these guys on youtube. I use to know Basic back in the eighties so the terminology and the understanding is not new, you know, variables, If statements and the likes so this shouldnt be to hard. Cheers
    upload_2019-3-2_21-5-35.png
     
    Kelgand likes this.
  41. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Hi reuno,

    is it possible to do multiple wall jump (on the same wall) just like Hollow-Knight and super meat boy? without the need to create new ability?

    Please advise.
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @AesopWorks > You'll need to extend the ability for its ProcessAbility to handle axis instead of buttons. The (xbox) gamepad triggers are treated as axis by Unity, not buttons.
    @DavidMBradbury > Thanks a lot for sharing this! Can I add it to the extensions repository?
    @Ajhound > At this point my advice would be, as others have mentioned, to take a few tutorials, it'll make it all easier. It's hard to answer your questions without any context.
    @bravery > No, it's not, you'd need to extend the wall jump ability (or create a new one) to do so. I can add it to the todo list if you want.
     
  43. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    22
    @Ajhound well worth it, watch the prices they up and down ever few days.
     
  44. DavidMBradbury

    DavidMBradbury

    Joined:
    Nov 18, 2012
    Posts:
    9
    Absolutely.
     
    reuno likes this.
  45. JohnnyBrovo

    JohnnyBrovo

    Joined:
    Feb 11, 2018
    Posts:
    4
    Hello I have a question about adding a recharge function to the projectile weapon script. I looking to work like the jet pack. I was seeing if there is a way to be able to do that. Using it for Magic based attack that can recharge mana over time?
    Thanks
     
  46. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Ohhh, ok please add it to the todo list.

    but at the same time can you please give me some direction to help me in implementing this?

    Thanks
     
  47. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,914
    @JohnnyBrovo > Of course you can. You'd need to create a new class for that, and indeed the jetpack's cooldown mechanism would be a good reference point.
    @bravery > it'd require a brand new system, that can't really be summed up like that. I've added it to the todo list!
     
  48. JohnnyBrovo

    JohnnyBrovo

    Joined:
    Feb 11, 2018
    Posts:
    4
    Thanks so much
     
    reuno likes this.
  49. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    614
    hey im interested in making an Outrun style game.
    So id use infinte corgi engine with a straight road with different spawners for different sections of the game.

    For the curves i was gonna use the Curved World plugin which uses a shader to curve all the meshes.
    This shouldn't be a problem with your plugin right?

    asking just in case. thanks.
     
  50. addz92

    addz92

    Joined:
    Mar 4, 2015
    Posts:
    19
    Hi guys,

    I've been a Corgi User for quite a while now, In fact it's what got me in to game design to begin with. I'm really proud to say my game "Crash Landed" is launching on steam next week! It's a sci-fi platformer that has some voice acting too :)

    https://store.steampowered.com/app/1014600/Crash_Landed/

    Wanted to say a special thanks to @reuno .I've always wanted to make a platformer and I couldn't have done it without you and this awesome community. Hope you guys can check it out :)!
     
    Reactorcore3, Meowx and Quinn221 like this.