Search Unity

[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,929
    @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.
     
  2. 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?
     
  3. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @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.
     
  4. 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
     
  5. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @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.
     
  6. 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?
     
  7. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @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.
     
  8. 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.
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @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.
     
  10. 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
     
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @omeggga > Please use the support email, thanks.
     
  12. 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.
     
  13. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
  14. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    231
    @reuno
    How about adding jump/shoot animation parameters to the weapon classes as well as jump/shoot modify movement parameters?
     
  15. 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?
     
  16. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @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.
     
  17. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    231
    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.
     
  18. reuno

    reuno

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

    Grafos

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

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Grafos > Not if you create a new instance of it before filling your pool.
     
  21. 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
  22. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @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.
  23. hippobob

    hippobob

    Joined:
    Feb 26, 2017
    Posts:
    33
    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.
     
  24. reuno

    reuno

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

    hippobob

    Joined:
    Feb 26, 2017
    Posts:
    33
    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.
     
  26. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @hippobob > I plan on making changes to the camera in an upcoming update, I'll keep your use case in mind.
     
    hippobob likes this.
  27. 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?
     
  28. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @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).
     
  29. adam-goodchild-omobile

    adam-goodchild-omobile

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

    BlastingGamesSL

    Joined:
    Jul 24, 2017
    Posts:
    8
    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! : )
     
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @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.
     
  32. 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.
  33. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    Boom_Shaka and Legionghost like this.
  34. 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
  35. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @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 :)
     
  36. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    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.
  37. achan_unity

    achan_unity

    Joined:
    Apr 23, 2018
    Posts:
    13
    Thanks. i figured out. The issue here is that the hotbar is not getting any touch event when the inventory is closed due to the logic in the InventoryInputManager. I have to override the InventoryInputManager to not disable Raycaster for my hotbar - as I want to allow my player to select the weapon without having to open up the inventory. I want to create a scheme that's similar to minecraft where we have an inventory bar at the bottom where all the items will be filled in there first and then the rest will be put to the main inventory.
     
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @achan_unity > That is indeed quite different from the example and will require coding. The engine will support that use case, no problem, just needs some UI work.
     
  39. DavidMBradbury

    DavidMBradbury

    Joined:
    Nov 18, 2012
    Posts:
    9
    Congrats on the new video, good stuff. I edited my post and sent the bug report to your e-mail via the contact page.

    To simplify my ask, I'll rephrase.

    If I create a new project and import Corgi Engine v5.4, then open MinimalRooms1, I'll enter the door to the right, then walk to the left. The two blue gates lead to different positions in the next level. However, when you enter, the camera starts in its default position and quickly moves to your character position over maybe one second.

    I'd like the camera to start where my character is when entering the room.

    Now, if I take CameraController.cs and say on line 40, add `transform.position = Target.position` this mostly works.

    However, it causes a different problem. Namely, with the parallax scripts.

    I made some modifications to MinimalRooms2 for testing purposes.

    https://i.imgur.com/6ZhhSZK.png

    I moved the regular camera to the LevelStartTop area and darkened the background color for contrast, aligned the background with the edge of the top platform, shrank it down, added the parallax element and gave it a horizontal speed of 0.5. Starting the scene like this works as expected.

    Now if you save and go the MinimalRooms1, then enter the LevelStartBottom entrance, then travel to where the camera was, the background will be at a different spot:

    https://i.imgur.com/1sjrWQK.png

    In my personal project, I have trees in the background that are aligned with different elements. I'd like them to appear in the same spot no matter which entrance I come from.

    I can dig into it myself or see about coding a parallax script that doesn't use the camera initial position, but I figure if this is already built in and I'm just missing something, I'd ask!
     
  40. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
  41. Lakris

    Lakris

    Joined:
    Jan 10, 2014
    Posts:
    17
    It is a great looking engine!
    I have been searching through a lot of the features (what is listed) But I can't figure out if it is possible in "3D platformer" to:
    Pick-up an object(ex. cube) and throw it as a "weapon" to harm enemies?
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Lakris > There's no example for this right now. It's doable of course, but would require some code.
     
  43. ceceomer

    ceceomer

    Joined:
    Sep 1, 2014
    Posts:
    24
    Hello @reuno
    I'm newbie about corgi engine. I'm trying to use your demo scene(Retro AI) but i don't understand default parameters on corgicontroller because when i change the speed acceleration on ground prooerty, everything is same. So how can i use them?
     
  44. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @ceceomer > Well no, if you change the speed acceleration on ground property, everything's not the same. Acceleration will be faster. That's what it does, as explained in the documentation. Now you're probably after speed, not acceleration, and that's defined in the CharacterHorizontalMovement component (well, for regular walk at least). I'd strongly suggest checking out the documentation, it's all explained in details.
     
    ceceomer likes this.
  45. Abrahamus

    Abrahamus

    Joined:
    May 16, 2014
    Posts:
    6
    Hi,

    I'm having a small problem with the Corgi Engine: Dialogue System Support package, which may not be top priority at the moment, but just in case. I tried with the package from the Third Party Support folder, and with the one from the Pixel Crushers website, Corgi Support (2019-02-01):
    And it looks like this (it's the same for the TriggerExit method below):
    Being honest, I have no idea if this should go here or within the Pixel Crushers forum, it's like a 50/50, sorry. I simply removed the override from both methods, you won't get those two errors, but... I don't know, surely there's more to it and to fix it properly there is another solution (not confident enough about simply removing override :') ).

    Oh, by the way, the Corgi Example scene from those packages has some missing prefabs. That's it, thanks for your time guys.
     
  46. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @Abrahamus > I don't know this asset you're talking about, not sure how I could help, it's not mine :)
    I'd suggest contacting their authors.
     
    Abrahamus likes this.
  47. macish

    macish

    Joined:
    Oct 29, 2018
    Posts:
    55
    Hello reuno

    New to Corgi Engine and digging through it and searching this thread up and down with infos if you can have abilities as pickup items. For example picking up an jetpack and the ability gets unlocked/modified (similar to weapons or keys, coins etc.)

    thnx in advance for the info :)
     
  48. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    239

    Yes you can. There is an entire inventory solution in the examples. The jetpack is actually set as an ability script that just gets attached to the player character. It has a few settings and you can simply make it active on a pickup.


    It's pretty simple.
     
  49. macish

    macish

    Joined:
    Oct 29, 2018
    Posts:
    55
    But i'm still puzzled, is there an example of such an ability pickup? U say its simple so i guess yes but for the life of me i cannot find it. Ok its pretty late over here and shuteye mode was initiated an hour ago but i can't find the demo level where this is happening. A nudge into the right direction would be appreciated! Thank you!
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,929
    @macish > No, there isn't (or I - again - completely forgot about it). I don't think there is :)
    That said it should indeed be quite simple to do.

    It's very simple if you want a regular pickup, and it'll be a bit more complex (but still quite easy) if you want to do it with inventory support.
    I'll explain the "regular pickup" version, it's more or less the same for inventory, check out the inventory doc to learn more about how to create items and all.

    Basically you'll want to create a new type of PickableItem (you can look at the Coin class, or Stimpack, or Mushroom for examples of how it's done.
    And just like the Mushroom class grabs the SuperHipsterBrosHealth component and targets it to call one of its methods, you'll want yours to grab, let's say CharacterJetpack, and set its AbilityPermitted to true (assuming it was false before). And that's all there is to it :)
    It's actually so simple that I just coded it, there you go :

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using MoreMountains.Tools;
    4.  
    5. namespace MoreMountains.CorgiEngine
    6. {
    7.     /// <summary>
    8.     /// Add this class to an object and it'll double the size of a character behavior if it touches one
    9.     /// </summary>
    10.     public class PickableJetpack : PickableItem
    11.     {
    12.         /// <summary>
    13.         /// Checks if the object is pickable (we want our picker to be a Player character).
    14.         /// </summary>
    15.         /// <returns>true</returns>
    16.         /// <c>false</c>
    17.         protected override bool CheckIfPickable()
    18.         {
    19.             _character = _collider.GetComponent<Character>();
    20.  
    21.             // if what's colliding with the coin ain't a characterBehavior, we do nothing and exit
    22.             if (_character == null)
    23.             {
    24.                 return false;
    25.             }
    26.             if (_character.CharacterType != Character.CharacterTypes.Player)
    27.             {
    28.                 return false;
    29.             }
    30.             return true;
    31.         }
    32.  
    33.         /// <summary>
    34.         /// on pick, we activate our jetpack ability
    35.         /// of course that's assuming it was false before, and you could have this behave in a more complex way if you want
    36.         /// </summary>
    37.         protected override void Pick()
    38.         {
    39.             _character.gameObject.GetComponentNoAlloc<CharacterJetpack>()?.PermitAbility(true);
    40.         }
    41.     }
    42. }
    I'll include that script in the next update.
     
    Muppo, addz92, macish and 2 others like this.