Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[RELEASED] Corgi Engine - Complete 2D/2.5D Platformer [new v6.1 : auto scrolling levels, and more]

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

  1. Legionghost

    Legionghost

    Joined:
    Nov 30, 2018
    Posts:
    16
    Hi, sorry for the noob question, but, what is the easiest way to modify a characters ability at runtime?
    I've been trying to use a KeyOperatedZone (auto activation and without a key enabled) with my player as object and change the ability there but it's not working for me.
    I've been trying to change the Jump Behaviour number of jumps from 1 to 2 when getting a powerup.
    I've tried a bunch of different function settings to see if anything works but it's not, perhaps I'm doing it wrong, although I have made several KeyOperatedZone work in my game.
     
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @Ajhound > I suggest creating a class to implement your own rules. I can't code that for you, it's too specific :)
    @matttardiff > These animations! Thanks for sharing this, and congratulations again!
     
  3. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @Legionghost > There's no generic answer, it depends on what you want to do, and whether or not the value you want to modify is being cached by the ability or not. But outside of that it's done like you would in any Unity project and class, you grab the class, modify its public attributes or use the provided methods.
     
  4. Legionghost

    Legionghost

    Joined:
    Nov 30, 2018
    Posts:
    16
    ok thanks, I'm not there yet in my learning, I just know how to enable/disable things right now. :)
    I'll keep trying to figure it out...
     
  5. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    103
    check out these (and other scripting) tutorials. They cover some of things you can do to make the most out of this engine. If they don't make sense right away, they will as you start reviewing the code comments.

    https://unity3d.com/learn/tutorials/topics/scripting/variables-and-functions?playlist=17117
    https://unity3d.com/learn/tutorials/topics/scripting/classes?playlist=17117
    https://unity3d.com/learn/tutorials/topics/scripting/statics?playlist=17117
    https://unity3d.com/learn/tutorials/topics/scripting/inheritance?playlist=17117
     
    reuno and Legionghost like this.
  6. Legionghost

    Legionghost

    Joined:
    Nov 30, 2018
    Posts:
    16
    Perfect thanks!
     
  7. Ajhound

    Ajhound

    Joined:
    Oct 6, 2018
    Posts:
    5
    @reuno i cant create a class i dont know how, no coding experience. Looking at the codes for RetroAdventure Stars, trying to figure out where at what everything does just isnt working. ok your coin script with the points how do you make this show up with your gem script? GemsToAdd
     
  8. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @Ajhound > There are no gems in the engine, I don't know what you mean. Unfortunately I don't know any other way to create a new feature than to code it. If adapting the coin script is too complex for you right now, maybe look for a simpler feature to implement, or look on the store, maybe there's a "coin to gem conversion" script. If you have more questions like this, please use the support email, thanks!
     
  9. Meowx

    Meowx

    Joined:
    Oct 10, 2015
    Posts:
    24
  10. Reactorcore3

    Reactorcore3

    Joined:
    Nov 27, 2018
    Posts:
    15
    I'm currently designing and mapping the art, character and level creating workflow and I wanted to ask three things:

    1) For an average PC platform, how big or small do you recommend the levels to be? Should I chop them up into chunks or is it ok to have large or wide or tall rooms that may take a few minutes to move through at full speed of the default minimal demo character?

    2) Can I make instant laser / beam / line projectiles for weapons easily in Corgi Engine? What would you recommend?

    3) Is it possible to make a Block / Defend state/function for characters (player and/or NPC), so that while a button is held down, any damage received is prevented?
     
    Last edited: Feb 23, 2019
  11. andrin_man

    andrin_man

    Joined:
    Mar 9, 2014
    Posts:
    6
    I have been trying to use the Freeze() and Unfreeze() methods on the CharcterController as a means to create a "Stunned" effect on enemy characters with certain attacks. However, I have noticed when Freeze() is called it sets the CharacterHorizontalMovement.Enabled to false which stops the character as desired but does not set it back to True when Unfreeze() is called leaving the enemy stuck in the same spot. I can not track down in the code where this is being set and wondering if this is expected or not. I suppose I could explicitly set it back to enabled in my code but was hoping there is a more elegant way to do this.

    Thanks
     
  12. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @andrin_man > No, Character's Freeze doesn't set anything on CharacterHorizontalMovement. It turns the gravity off, sets forces to zero and changes the state to Frozen. This is reverted by Unfreeze. Don't hesitate to look at the code for more info on this.
    @Reactorcore3 > 1. that is unrelated to the engine. It just depends on your tech stack, device target, gameplay, etc. There's no generic answer to that.
    2. That's not built-in if that's your question. But sure, with all the weapon related classes, that shouldn't be hard to do.
    3. Sure it's possible. I'd recommend creating a new ability for this, that acts on the Health component to prevent damage, there's already a method for that.
     
    Reactorcore3 likes this.
  13. matttardiff

    matttardiff

    Joined:
    Feb 27, 2018
    Posts:
    15
    Meowx and reuno like this.
  14. addz92

    addz92

    Joined:
    Mar 4, 2015
    Posts:
    18
    Hi all , I've managed to put a script together that allows a player to pick an ability up. For example the player finds a power up item and learns the ability to wall jump. My issue however is the power up doesn't persist between scenes. So the player may be able to walljump in scene A , but can't in scene B.

    Is there a way to somehow save the added ability? I've tried using the inventory and assigning the ability to an item there but the issue remains. Thanks in advance :)
     
  15. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @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.
  16. addz92

    addz92

    Joined:
    Mar 4, 2015
    Posts:
    18
  17. 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?
     
  18. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
  19. kurt11205

    kurt11205

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

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    17
    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!
     
  21. 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. }
     
  22. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    17
    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();

    }
    }
     
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @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.
  24. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    17
    Thanks this helps!
     
  25. 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.
     
  26. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @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.
     
  27. 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?
     
  28. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @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!
     
  29. 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.
     
  30. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @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.
     
  31. adam-goodchild-omobile

    adam-goodchild-omobile

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

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
  33. adam-goodchild-omobile

    adam-goodchild-omobile

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

    Subzeroblack68

    Joined:
    Apr 3, 2014
    Posts:
    18
    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
     
  35. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @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).
     
  36. Reactorcore3

    Reactorcore3

    Joined:
    Nov 27, 2018
    Posts:
    15
    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
     
  37. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @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.
  38. PaulAfello

    PaulAfello

    Joined:
    Sep 19, 2015
    Posts:
    15
    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
     
  39. 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.
     
  40. Quinn221

    Quinn221

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

    Attached Files:

  41. PaulAfello

    PaulAfello

    Joined:
    Sep 19, 2015
    Posts:
    15
    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.
  42. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    17
    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)
     
  43. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    17
    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:

    luigi-freguglia, Muppo and Boom_Shaka like this.
  44. Boom_Shaka

    Boom_Shaka

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

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    103
    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.
     
  46. Quinn221

    Quinn221

    Joined:
    Oct 16, 2017
    Posts:
    17
    @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.
  47. Reactorcore3

    Reactorcore3

    Joined:
    Nov 27, 2018
    Posts:
    15
    Thank you, this gives me clarity.
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,124
    @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.
  49. 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?
     
  50. reuno

    reuno

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