Search Unity

[RELEASED] Corgi Engine - Complete 2D/2.5D Platformer [new v6.3 : throw objects, pressure pads]

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

  1. 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! :)
     
  2. 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.
  3. 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.
  4. 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.
  5. 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.
     
  6. reuno

    reuno

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

    Quinn221

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

    DavidMBradbury

    Joined:
    Nov 18, 2012
    Posts:
    9
    Absolutely.
     
    reuno likes this.
  9. 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
     
  10. 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
     
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @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!
     
  12. JohnnyBrovo

    JohnnyBrovo

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

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    511
    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.
     
  14. addz92

    addz92

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

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @addz92 > Congratulations on your release! I'm glad the engine helped :)
    @luniac > The Corgi Engine and the Infinite Runner Engine are two completely different, and unrelated assets. And I've never tried that plugin you mention, so I wouldn't know.
     
  16. omeggga

    omeggga

    Joined:
    Mar 2, 2019
    Posts:
    5
    Hello, I've been meaning to make my character change weapons programatically based on movement, any idea how to go about it?

    Basically if she jumps she kicks, if she walks she does a simple smack, if she's still she can combo. All the weapons are already made, but how do I tell Corgi to keep an ear out for character movement states?
     
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @omeggga > As explained in the documentation, from any ability you can watch a character's _movement.CurrentState, that'll tell you what state it's in. You'll find tons of examples of that throughout the engine, in pretty much every ability for example.
     
  18. omeggga

    omeggga

    Joined:
    Mar 2, 2019
    Posts:
    5
    @reuno
    That being said, how do I load in a weapon prefab?

    UnityEditor.AssetDatabase.LoadAssetAtPath("classifiedPathdueToPrivacy", typeof(Weapon));

    doesn't seem to work
     
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @omeggga > I don't know what you expect that line to do :)
    I'd recommend using the methods included in the engine, ChangeWeapon does that.
     
  20. omeggga

    omeggga

    Joined:
    Mar 2, 2019
    Posts:
    5
    @reuno
    I'd expect it to take a weapon prefab from the list of assets and paste it in the "currentweapon" variable... is that not how you instantiate a new weapon based on already existing assets?
     
  21. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @omeggga > No, it's not :)
    And you don't even target CurrentWeapon with that line, it simply can't work.
    I'd suggest looking at the CharacterHandleWeapon class to see how it's done.
     
  22. omeggga

    omeggga

    Joined:
    Mar 2, 2019
    Posts:
    5
    @reuno
    The only way I see it being done in references is via already instances objects. I suspect the only way to do this is to simply make a class that extends from CharacterHandleWeapon, dump the prefabs there and tell it to change weapons based on movement.
     
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @omeggga > That is indeed a great way to do it. It could be a new ability as well (it doesn't have to extend CHW), that simply watches the state, holds a list of prefabs, and changes the CHW's current weapon on demand.
     
  24. omeggga

    omeggga

    Joined:
    Mar 2, 2019
    Posts:
    5
    @reuno
    May I DM you? I seem to have a few more issues and I'd rather not clog this comment thread
     
  25. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @omeggga > Please use the support email, thanks.
     
  26. bravery

    bravery

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

    I'm trying to write my custom ability however I'm stuck with input check, how can I check for the following:
    1- if you pressed dash button + up and left direction.
    2- if you pressed dash button + down and right direction
    ...etc

    So I want to check the combination of button press + detecting the pressed direction (up, down, left, right, up+left, up+right, Down+left, down+right)?

    Please advise.
     
  27. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
  28. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    219
    @reuno
    How about adding jump/shoot animation parameters to the weapon classes as well as jump/shoot modify movement parameters?
     
  29. bravery

    bravery

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

    What about the input manager class exist in corgi?

    My question was how to implement it using the input manager class? because there is no explanation how to use those?
     
  30. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @bravery > You can also do it like that if you prefer, seems overkill for what you're after, and the result will be exactly the same. I'm not sure what you mean by no explanation, the class is fully commented, and there's a whole documentation page about it.
    @Grafos > Seems quite specific. I can add that to the todo list if you want, but it looks like a feature duplicate from the existing modifiers, and it should be pretty easy to implement it on your own from what's already there. I'd rather not add more useless (in most cases) complexity to that class.
     
  31. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    219
    Fair enough, I'll try extending the existing class, thanks for the prompt reply.

    On a different note, I would like to have power-ups that improve my projectile weapon's characteristics: the rate of fire, power, range etc. How would I go about doing that? It seems that for some characteristics (power and lifetime for instance) I need to somehow access each projectile instance created by the Object Pooler to manipulate the values. Having multiple weapons is a no go, as I would have to make a marginally different weapon for each combination of parameters.
     
  32. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @Grafos > It'd be more efficient to modify these values on the prefab directly (by code or by hand) before filling the pool.
     
  33. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    219
    But then the modified attributes will apply to all players/enemies firing that projectile, won't they?
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @Grafos > Not if you create a new instance of it before filling your pool.
     
  35. adam-goodchild-omobile

    adam-goodchild-omobile

    Joined:
    Jan 12, 2017
    Posts:
    13
    @reuno Could you look at adding to your list the extraction of instantiating "effects" into their own methods, so we can more easily override the functionality if needed (for example to spawn effects via our own Pooling system). A good example is inside the Health script where the Kill method has a lot going on, and we only need to edit that section.
     
    Last edited: Mar 5, 2019
  36. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @adam-goodchild-omobile > This is actually super high on my list right now. I plan on replacing all "hardcoded" effects, whether it's sound, vfx, etc, with my MMFeedbacks system, as I did recently in the TopDown Engine.
     
    Boom_Shaka and Legionghost like this.
  37. hippobob

    hippobob

    Joined:
    Feb 26, 2017
    Posts:
    25
    When a character falls too far, the camera can't follow him. I have to set the camera's displacement to 0. Otherwise the camera can't find the character in the falling.

    For example, the character falls into a deep tunnel. The camera cannot track the character until it reaches the bottom.
     
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @hippobob > That seems normal, that's why you can change the camera's speed and other settings.
     
  39. hippobob

    hippobob

    Joined:
    Feb 26, 2017
    Posts:
    25
    The problem is that I want to be able to keep the camera moving while the character is moving. Otherwise, I'd have to be like Mario on the NES. Keep my camera fixed to the character forever.
     
  40. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @hippobob > I plan on making changes to the camera in an upcoming update, I'll keep your use case in mind.
     
    hippobob likes this.
  41. achan_unity

    achan_unity

    Joined:
    Apr 23, 2018
    Posts:
    13
    Hello, I want to create a hotbar that will correspond to mouse click and navigator.. so I added the Hot Bar component to an inventory display - but it doesn't look like it capture any keyboard or mouse event. in the PixelRogueRoom1 example, the Bomb hotbar doesn't seem to do anything for me.. I cannot click on it to navigate between the different inventory slots. Is what I try to do possible?
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @achan_unity > As explained in the documentation, the way the hotbars work right now (with the InventoryHotbar class) is that they're regular inventories that are also bound to a key (and alt key, specified in the inspector), with an associated action. Pressing that key ("k" IIIRC in the rogue demos) will activate that action on whatever object is there. So in the demo you get a hotbar for bombs. You collect bombs, they go to that inventory, you press "k", bombs get used.
    Apart from that they're regular inventories, you can absolutely click on them and then on the buttons (use, etc) to interact with them, they act just like every other inventories (they extend them actually).
     
  43. adam-goodchild-omobile

    adam-goodchild-omobile

    Joined:
    Jan 12, 2017
    Posts:
    13
    Amazing, thanks for that!
     
    reuno likes this.
  44. VandalProductions

    VandalProductions

    Joined:
    Jul 24, 2017
    Posts:
    3
    Hi!
    I'm trying to add a sound when the character lands after jumping or falling, but there doesn't seem to be a slot already prepared to pick an AudioClip to be played when landing, right? If there isn't what would be the easiest way "to detect a landing", is there any Event for that maybe?
    Thanks! : )
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @VandalProductions > No, there is no such slot for now (or event either). The only thing right now is an animation parameter (a boolean, called HitTheGround) that gets true every time you hit the ground. You could use that to hook your thing.
    But as I was saying to @adam-goodchild-omobile a few posts above yours, I plan on reworking these effects/events thing very soon, and I'll keep the landing thing in mind for that.

    In the meantime, you could also create a very simple class that you'd put on your character. What this class would do is grab a reference to the controller on start (let's call it _controller), and then on update it'd watch the value of the _controller.State.JustGotGrounded boolean. Every frame it turns true, you've just hit the ground after a fall/jump.
     
  46. Legionghost

    Legionghost

    Joined:
    Nov 30, 2018
    Posts:
    16
    Adding fx and sfx's in 'Touch The Ground Effect / Touch the Ground Sfx' in Character Horizontal Movement component works for me when the character lands after jumping or falling..
     
    reuno likes this.
  47. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    Boom_Shaka and Legionghost like this.
  48. DavidMBradbury

    DavidMBradbury

    Joined:
    Nov 18, 2012
    Posts:
    9
    Edit: Removed bug report and sent e-mail

    Also, I'm still looking into this but I could be doing something wrong. When you use GoToLevelEntryPoint, the camera will animate from its default position. I'd like the camera to start where the player enters (having multiple places in the scene where the player could enter from).

    I tried checking "Instant Reposition Camera on Respawn" and that didn't work. Then I tried setting the camera speed to 0 and then on the first update, change the speed back to normal, and that made both the parallax script and horizontal look distance act funny.

    Thanks!
     
    Last edited: Mar 9, 2019
  49. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    @DavidMBradbury > Please use the support email if you think you've found a bug, thanks. And please provide steps to reproduce, and describe what behavior you're getting, "act funny" is a bit too vague :)
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,370
    I just published a new tutorial video, that covers most of the new things introduced in the last 3 updates of the engine : push / pull mechanics, time control, time zones, ledge hang & climb, ziplines, character swap, instant acceleration, and how to extend abilities to modify how they handle input (when input manager is not enough). I hope you'll like it!

     
    polyconvex, Meowx, hippobob and 2 others like this.
unityunity