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. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    Just posting here to say that I'm using this asset with 2DDL Pro and Ferr2D - awesome combo, I'm finally able to visually create the ideas I have in my head and Corgi provides all of the functionality. Many thanks!
     
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @BioBurden > That's good to know, thanks for your feedback on this.
    On a related note, the next version will include a better "stick to slope" ability, that will make working with uneven surfaces (such as the ones generated with Ferr2D) more reliable.
     
    kevin_Leo, Zehru, CHEMAX3X and 2 others like this.
  3. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    I was wondering if anybody has any experience displaying the weapon delay before use on the UI as a "cooldown" timer?

    My first thought was pretty basic: grab the _delayBetweenUsesCounter value and put it in the GUI as a shaded overlay on its corresponding weapon if greater than 0.

    Unfortunately, I can't just go with "basic", even if it works, so I started looking at putting in as a progress bar. I reviewed the Health and Jetpack Bars for examples, but they appear to be set up differently:
    • Healthbar has a dedicated script that can be added to any object
    • JetPackBar is a function on GUIManager updated/called from the CharacterJetpack script
    Am I reading that correctly? Is there any difference between the two in terms of performance? It seems like the JetPackBar model would be more appropriate for this use but I'm open to suggestions. Thanks in advance.
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @Boom_Shaka > There's a MMProgressBar class for that. It's all documented, you should check it out.
     
  5. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    Sorry, I must be looking in the wrong place. The only progress bar references I can see right now (looking at 5.0 api) are:
    • JetpackBar
    • HealthBar
    • MMProgressBar
    • MMProgressBarDemoAuto
    • MMRadialProgressBar
    I also looked at adding it to the Ammo Display - that could work too, but it seemed like it made more sense to extend Weapon.cs
     
  6. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @Boom_Shaka > That's the third item of your list. You can also use the 5th one, it's the same thing but for radial bars :
    upload_2018-7-14_14-51-10.png
     
    Boom_Shaka likes this.
  7. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    Gotchya, I thought you meant there was already a dedicated "cool down" (or similar) class. MMProgressBar is actually what directed me to Healthbar as a use case, so I think I'm good to go. Cheers!
     
  8. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @Boom_Shaka > Not sure why you'd need a cooldown class, that info is already in the weapon :) Pretty sure MMProgressBar is all you need. You can update it using the UpdateBar method, it's a one liner.
     
  9. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    don't need one, just misunderstood your response.

    I'm good, thanks :cool:
     
    reuno likes this.
  10. Brinstar

    Brinstar

    Joined:
    Jul 28, 2017
    Posts:
    4
    Hi @reuno

    First thanks for your answer. Sorry if I took time to answer you back i was making sure that I have done the thing correctly. So I dive again into the documentation and not in your but in unity documentation I have found some answer to my problems. Like I am new to unity i was sure i was configuring some stuff wrong and that was the case indeed lol

    So for now i resolve all my problem :) But I have a question though:

    I use your engine to have an exemple of good code, and today i was looking to make from scratch a blend tree to understand how to make it (just practice). I took the one of super hipster bros. I slide my animation first in the blend tree of super hipster bros and everything was fine. my character was moving, having the right animation, etc. When I have start to make a blend tree from scratch, creating my own playable character with the SAME animation, only one was playing though (the idle one), even if my character was moving frm right to left, was able to jump, etc...Do you know why? Is it something that have to deal with the scripts (like a function or something else that is called from the script to the blend tree of your demos) or something else?

    It is not a vital question though, I am just wondering because i have spent basically the all afternoon today to understand why, dive into unity forum and your own documentation and i don't why it is doing that when with the same animation in your blend tree everything works fine. Voila! :)
     
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @Brinstar > Probably nothing to do with the scripts, blend trees are part of Unity's animator, nothing to do with the engine, and there's nothing in the engine's code that controls them.
     
  12. Brinstar

    Brinstar

    Joined:
    Jul 28, 2017
    Posts:
    4
    @reuno Ok, so it is not in the engine code, thanks :)
    Good afternoon!
     
    reuno likes this.
  13. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    Some things that helped me when I was having trouble with animations:
    1) Make sure your animation parameters are spelled correctly. Can't tell you how long it took me to realize I spelled "MeleAttack" wrong.
    2) Make sure you transition logic flows together. The biggest problem I had early on was conflicting transitions - the engine was either firing multiple animations or no animations
    3) Make sure your character is set up correctly. If it moves but only shows the default/idle animation, there's a chance your Character component isn't reading your custom animator
    4) Take an animator you like, copy it and then customize it. I found that easier at first than creating a new animator from scratch.

    Hope this helps!
     
    Muppo and reuno like this.
  14. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    Awesome stuff.
    Quick suggestion; for the Projectile Weapon script, if utilising Aim Control = Mouse and Rotation Mode = Free, it might be really nice to include a simple checkbox to auto-orient the player to face the current mouse direction. Eg. if the player is facing right and you move the mouse to the left of the player, have the player automatically face the left.
     
    Last edited: Jul 19, 2018
  15. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @BioBurden > It's a cool feature. I'll add that to the list.
    To be fair I'd say it has low chances of making it into the engine as it's quite specific, and something that is already easily doable with what's already there. For each feature I have to weigh whether it's beneficial to most people, and if not, if it'd be easy to do or not (otherwise it all becomes a mess, and hard to read). In this case it'd be a low percent of people, and it's quite easy to do as all methods are already in the engine, and pluggable together with 1 or 2 lines of code. But if it gets more requests, we'll see :) I'll be happy to help if you have trouble implementing it though!
     
  16. tysonwills

    tysonwills

    Joined:
    Oct 30, 2016
    Posts:
    14
    Hi reuno
    I have spoke to you on email about trying to get this sorted and you give me some good advice, but still cant get sorted so was wondering if someone on here could point me in the right direction.

    What I need is to make the player be able to walk off the right hand side of the screen and appear on the left and vice versa.
    It is a single screen game with no scrolling.
    I discovered a script called CharacterLevelBounds and has a section that checks for left and right bounds.
    I amended the code to try and make the player wrap around but nothing seems to work.

    Thanks


    if ((Right != BoundsBehavior.Nothing) && (_controller.ColliderRightPosition.x > _bounds.max.x))
    {
    ApplyBoundsBehavior(Left, new Vector2(transform.position.x = Left,_bounds.min.x));
    }

    if ((Left != BoundsBehavior.Nothing) && (_controller.ColliderLeftPosition.x < _bounds.min.x))
    {
    ApplyBoundsBehavior(Left, new Vector2(transform.position.x = Right, _bounds.max.x));

    }
     
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @tysonwills > As I explained via email multiple times already, you'd have a much easier time looking at the teleporters. I'm not sure what you expect ApplyBoundsBehavior to do in this case, but that's not gonna work. If you look at the doc (or the code) you'll see this method will simply apply the selected behavior (kill or constrain) to the character. That's certainly not gonna teleport you on the other side of the screen.
    Again, teleporting a character simply means updating its position. That's all you have to do, and you'll have a great example of that in the teleporter script.
    So it's a simple condition on whether or not you've reached your "teleport zone" based on your character's coordinates, and then you move it.
     
  18. Kelgand

    Kelgand

    Joined:
    Feb 3, 2018
    Posts:
    10
    @tysonwills What you are trying to do is not Corgi-specific, it is a thing that you can learn more about by Googling "Unity 2D screen wrap", or a similar search. You are having trouble finding a solution inside the Corgi Engine because there isn't one. In my opinion most 2D platformers would not need this feature (as we tend to like big open areas with walls and boundaries at the edges), so those that do would be special cases. While it shouldn't be difficult to add as you are just changing the player's transform position, again this is not a Corgi-related issue so you won't find code to solve this inside the engine.

    You would have better luck getting assistance for this by searching for "screen wrap" or asking in one of the general question areas...which I was going to link here, but when looking in the "Scripting" forum I see you already have a thread going there with some replies.
     
    reuno likes this.
  19. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    231
    Reuno, a feature for your consideration, can we have rope bridges such as this one?

    I believe they are made using spring/hinge joints, but the engine does not currently support interaction with those.
     
  20. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    I'm still a beginner to Unity and C# and while I understand the concept of inheritance and method overriding etc. I'm not quite sure how I go about this with Corgi within Unity. Is it a case of creating my own script, doing such things in there and then assigning that to where it's needed?
    Perhaps a simple example of the functionality I require and including it in the docs instead of in the engine?

    Thanks in advance.
     
  21. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @BioBurden > In this case the methods I mention are already documented. It wouldn't be possible to document all their possible combinations, that'd be infinite :)
    Plus there's a dedicated section in the documentation about extending the engine and inheritance which could act as a starting point. The short version would be, to do something like this, you'd extend WeaponAim into a new class, let's say WeaponAimFaceDirection, and override one of its method to add a test based on aim direction and current facing direction, and call the Character component's Face method according to the result of that test.
     
    BioBurden likes this.
  22. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    Many thanks, this will be a nice starting point for getting my feet wet with customisations.
     
    reuno likes this.
  23. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    I've given this a shot and I finally got it (learning a lot about C#, Unity and Corgi), however, I'm not sure if I've done things right as I'm seeing the below issue. The aim cursor seems to "jump" for a second when it crosses 90/-90 degree threshold (example attached).

    Perhaps I'm not implementing my overrides correctly, but here is what I have done to accomplish mouse-aim.

    Code (CSharp):
    1. using MoreMountains.CorgiEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class WeaponAimFaceDirection : MoreMountains.CorgiEngine.WeaponAim
    7. {
    8.  
    9.     new void Update() {
    10.         GetCurrentAim();
    11.         DetermineWeaponRotation();
    12.         MoveReticle();
    13.         HideReticle();
    14.  
    15.         if ((_weapon.Owner.IsFacingRight) && (CurrentAngle > 90 || CurrentAngle < -90))
    16.         {
    17.             _weapon.Owner.Face(Character.FacingDirections.Left);
    18.         }
    19.         else if ((!_weapon.Owner.IsFacingRight) && (CurrentAngle > 90 || CurrentAngle < -90))
    20.         {
    21.             _weapon.Owner.Face(Character.FacingDirections.Right);
    22.         }
    23.     }
    24. }
    25.  
    Any advice is much appreciated. :)
     

    Attached Files:

  24. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @BioBurden > It'd be safer to just call base.Update() in your method instead of just copying everything, that way if that method changes you won't have to update your method.
    As for why it "jumps", you might want to use debug logs to see what's wrong, frame by frame. Maybe adding a delay so it's not that strict might help. It usually takes some time to figure out stuff, and you'll progress faster if you try a little on your own :)
     
    BioBurden likes this.
  25. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    So I've played with this for far longer than I'd like to admit and I think it might have something to do with when the weapon is flipped with the character (via the ProjectileWeapon script) and what impact this may have on the reticle's (temporary) position, but I can't be certain.

    The issue does seem to be with the flip though (from what I can tell) as if I disable ProjectileWeapon, Position, Flip Weapon On Character Flip, then the issue doesn't occur (but obviously the weapon then doesn't flip).
    I'm still learning, but man, there's a lot of (amazing) code to dig through to try to join the pieces together and determine what could be causing this issue is not easy. If anyone has any input, I'd love to hear it.

    Thanks.
     
    Last edited: Jul 20, 2018
  26. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @BioBurden > I don't know what your exact problem is, but the reticle, the flip and the aim have nothing to do with the ProjectileWeapon script. That'd be WeaponAim. Once again, I'd suggest using debug logs, or (better) your IDE's debugger to check what might be wrong with your code. Just disabling random components is probably not what you want to do, and it doesn't seem to work :)
     
  27. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    The ProjectileWeapon script has a checkbox to flip the weapon on character flip, with this enabled, I then experience this bug.
     
  28. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @BioBurden > Oh okay! Btw I've added your request to the todo list, if it gets more votes it'll make it into the engine!
     
    BioBurden likes this.
  29. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    115
    Many thanks, and thank you for all of your help and suggestions thus far. I'll park this for now and return to it later as I have so much more to learn as it is.
     
    reuno likes this.
  30. jasonxtate66

    jasonxtate66

    Joined:
    Nov 21, 2017
    Posts:
    133
    Has anyone had issues with the new combo weapon - i.e. when you are crouching or jumping?
    For example... I only want the combo when the character is standing. I've messed with the animation parameters but the character can still combo in the air.

    Can the combo melee weapon just double as a plain melee weapon (when jumping and attacking, or crouching and attacking)? Have I just not set up my parameters correctly? Is "Sword1" the default parameter for the combo weapon's main attack?
    I'm coming over from a painful port from 2017, and had to re-do everything... so bear with me.
     
    Last edited: Jul 26, 2018
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @jasonxtate66 > You may be confusing a few things here. If you want to prevent the weapon to combo (or to be used?) when crouched or another state, don't try to prevent that in the animator. You'll want to prevent that in code.
    And there's no default animation parameter for weapons, you define them on a per weapon basis. I'd suggest reading the dedicated documentation about weapons at this point, it'll probably help.
     
  32. jasonxtate66

    jasonxtate66

    Joined:
    Nov 21, 2017
    Posts:
    133
    Darn. That's one of the features I was really looking forward to.
    So the combo system is only designed to work standing?
    Do you have a suggestion where to start with doing that via code, or would it just be easier for me to go back to using the regular melee?
     
  33. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @jasonxtate66 > I'm not sure what you're talking about, melee weapons (just like any weapons btw, there's no difference) work just fine when crouched or in other states (as they should). A weapon doesn't have to look at your standing state to work. It'd be really bad logic and architecture. You could use these weapons even without a character.

    What you can do however is add a check in CharacterHandleWeapon to prevent the use of a weapon when in certain circumstances. Just extend the class and add an if condition to prevent it from firing when in any other state(s) than the one(s) you want? It's that simple. We're talking one line of code here.
     
  34. jasonxtate66

    jasonxtate66

    Joined:
    Nov 21, 2017
    Posts:
    133
    No, here is my question:

    My game is done via sprites. So when I crouch for example, and use my combo sword... my character goes into the standing combination animation. I just want to use the sword regularly when crouched. I don't want to prevent it from firing.
     
  35. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @jasonxtate66 > But this is entirely dependent on your animations. It has nothing to do with the weapon itself :) (or the engine) Just setup your animator so it plays a standing animation then.
     
  36. jasonxtate66

    jasonxtate66

    Joined:
    Nov 21, 2017
    Posts:
    133
    Figured it out. Was animation settings.
     
  37. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @jasonxtate66 > Don't hesitate to check out the documentation in situations like these, it's all explained in details.
     
  38. Meowx

    Meowx

    Joined:
    Oct 10, 2015
    Posts:
    33
    Any suggestions on how I would go about creating separate acceleration and deceleration values for the SmoothMovement function?
     
  39. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @Meowx > Extend the class and add separate values based on the current state.
     
    Meowx likes this.
  40. kevin_Leo

    kevin_Leo

    Joined:
    Mar 20, 2018
    Posts:
    15
    Hi - I am impressed by the new release and your engine seems to be chock full of terrific things. Congrats on everything you have accomplished with it! I would love to use it, but there is only one thing that prevents me. I am looking to develop a game where the characters will not lose contact with the surface of the ground when running past the crest of a slope. Do you have any plans to implement the 'rail-style running' feature that we talked about a while back? It's literally the one thing that is preventing me from using your engine. Everything else looks tremendous, but without this level of control, a Mario 3 style handling of ramps is not yet supported by your engine (unless I am mistaken). Do you have plans to expand your engine to support the style of one of the most popular platformers of all time? :D
     
  41. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
  42. kevin_Leo

    kevin_Leo

    Joined:
    Mar 20, 2018
    Posts:
    15
    that's great to see! Thank you - Can you share any kind of a rough estimate of when the next version will be released? (I just need to know if this is a matter of waiting days, weeks or months). Thanks. :)
     
  43. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @kevin_Leo > Nope, I don't give estimates. Things get released when they're properly tested and working. That's unpredictable, by nature.
     
  44. makeitfun

    makeitfun

    Joined:
    Jan 6, 2018
    Posts:
    3
    Excellent asset! Got a speed boost for my character working by applying the CharacterHorizontalMovementOverride script to a game object with a 2d trigger collider. How can I return the character to normal speed after 3 seconds? Been trying but my artist brain keeps getting compiler errors :)
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @Gipperww2 > You'll probably need to implement a cooldown and then restore some saved values afterwards. There are many different ways to implement that. Nothing specific to the engine though :)
     
  46. stmaddox

    stmaddox

    Joined:
    May 15, 2016
    Posts:
    9
    I just updated to v 5.0. One thing I don't like about Unity is when a script was changed in the asset, it just says "missing script" instead of leaving the old name in the box with an error message that it is not there anymore. It would make it much easier if there was a list of what script names have been changed and the name of the new version.
    Is there such a list in the Corgi Engine website somewhere?
     
  47. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @stmaddox > There's no such list. I'd recommend using your versioning software (I use git) to check what changed. Most (if not all) of the renamed classes in 5.0 are MMTools classes, that just got a MM added for consistency. So ProgressBar became MMProgressBar, etc. I think it wasn't more than 5 classes that got renamed, or something like that. It shouldn't happen again anytime soon.

    And I completely agree, this "missing script" is the #1 thing I'd change in Unity if I had the chance. At least mention what the old one was called, if you can't properly link to the new one. In its current state it makes some situations really hard to handle.
     
  48. stmaddox

    stmaddox

    Joined:
    May 15, 2016
    Posts:
    9
    I will have to go look up what versioning software is and does. Thanks Reuno.
     
    reuno likes this.
  49. millionapper

    millionapper

    Joined:
    May 5, 2017
    Posts:
    2
    hi i have a question. Whenever i go into swim i can only jetpack my way out. I saw the update with CharacterSwim but i can't find the script anywhere? could you guide me on this? thanks @reuno
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,916
    @millionapper > I'm guessing you don't have the latest version of the engine then. I'd suggest reading the first item of the FAQ, it should solve the problem. If it doesn't, don't hesitate to use the support email, I'll be happy to help.