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,923
    @mimminito > Well the animator is outside of the scope of the Corgi Engine, it's just regular Unity at this point, so really it's up to you how you decide to build it. All the engine does is update animator parameters. There are tons of different ways to setup an animator, and depending on your tech (spine, 2D, 3D, etc) it can vary wildly. That's why I think it's best that the engine is agnostic in that regard.
    So my advice here would be to look up Unity's doc about it :)
     
  2. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Looks like its Spine related... Yay...

    Doing some more reading they have a layer mix mode which if changed, stops these issues. I think this has solved all the issues, just need to now ensure the character cannot walk whilst firing now.
     
    reuno likes this.
  3. Magixapps

    Magixapps

    Joined:
    Mar 4, 2017
    Posts:
    55
    Hi,
    i have just create new project and import the last version but i have this error:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.GridPaintingState.UnregisterPainterInterest (UnityEngine.Object painter) (at C:/buildslave/unity/build/Modules/TilemapEditor/Editor/Managed/Grid/GridPaintingState.cs:197)
    UnityEditor.GridPaintPaletteWindow.OnDisable () (at C:/buildslave/unity/build/Modules/TilemapEditor/Editor/Managed/Grid/GridPaintPaletteWindow.cs:565)

    if you can help me
    Thanks ^^
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @BOOapp > This looks like a Unity error, not a Corgi Engine error (look at the paths).
    What version of Unity are you running?
     
  5. NAiLz

    NAiLz

    Joined:
    Apr 17, 2013
    Posts:
    88
    Thanks as always @reuno
     
    reuno likes this.
  6. Magixapps

    Magixapps

    Joined:
    Mar 4, 2017
    Posts:
    55
    Version 2017.3.0f3
    But i not see where is Paths on that version
     
  7. NAiLz

    NAiLz

    Joined:
    Apr 17, 2013
    Posts:
    88
    @reuno

    I'm having a bit of trouble with the parallax elements script. It seems to be working just fine and in my preview window I'm getting 90+fps but the backgrounds move in a very choppy manner. They aren't smooth. Any idea why this is happening? I actually think it's the player who is moving in a choppy way and the parallax is just keeping up. Hmmm.
     
  8. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @NAiLz > Does the problem happen with any of the demos?
    @BOOapp > I meant the paths in the error you reported. It's a Unity error.
     
  9. Lairizzle

    Lairizzle

    Joined:
    Dec 6, 2014
    Posts:
    16
    Hey,

    I wanted to share something I was able to create which can act like a trap/landmine. I was able to take advantage of the soundmanager and the existing destroy scripts to help with this. As you will see in the video you can easily adjust the intervals for countdowns and even delay the initial countdown on the trap. Since the explosion is instantiated (thank you pathed projectiles examples) you can also create prefabs for different blast radius sizes. Cheers!

     
    reuno and Muppo like this.
  10. Magixapps

    Magixapps

    Joined:
    Mar 4, 2017
    Posts:
    55
    Last edited: Feb 9, 2018
  11. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    Is there A way to have an AI Follow Script just stop following? I tried to disable as a test:

    gameObject.GetComponent<AIFollow>().AgentFollowsPlayer = !gameObject.GetComponent<AIFollow>().AgentFollowsPlayer;

    but if it is in motion it remains in motion of into la la land. I would like to figure out how to just stop it dead in its tracks (if it is jetpacking or jumping it just falls... ) if it is running walking it just stops. Is there a way to do this? Do I have to get the Character State and set it to something like paused?
     
  12. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
  13. rbagao

    rbagao

    Joined:
    Feb 13, 2016
    Posts:
    19
    @reuno will the input manager (mobile) will still work even though my game is not a 2d platformer one? I'm planning just to use left right and fire. tia
     
  14. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @rbagao > I'm not sure why you'd keep this input manager for that, but sure, why not.
     
  15. NAiLz

    NAiLz

    Joined:
    Apr 17, 2013
    Posts:
    88
    I changed LateUpdate to Update in the multiplayercameracontroller script and this fixed it. I haven't gone through all the demos but it wasn't occurring in any that I tried. Maybe it's specifically the multiplayer camera controller.
     
    reuno likes this.
  16. NAiLz

    NAiLz

    Joined:
    Apr 17, 2013
    Posts:
    88
    @reuno Haha I'm sorry. I've been alot of trouble lately! ;) I'm having a strange problem where the character is going through a collider that is at an angle while using a jetpack. Let me know if the gif is enough to show you what's going on. I don't know if it's because I failed to notice a slope setting I need to change or what but if you have any idea what's going on, I would very much appreciate it! Thanks as always!

     
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @NAiLz > Yup, that's "normal". The way the jetpack works is that it detaches you from the ground, to save on useless checks. If it's not pushing you in the air fast enough, you'll go through the ground. That's how most games do it, it's pretty rare to have a jetpack that is slower than just walking up a slope :)
    Either increase the jetpack force, or override it to implement your own rules.
     
  18. LaurieCF

    LaurieCF

    Joined:
    Jul 8, 2013
    Posts:
    10
    @gljmelton
    Hi, did you ever find a good solution to this? I recently bought Corgi and am eager to tailor the jump to remove the spike and get a small arc. For now I've had to turn off proportional jump!
    @reuno
    Loving the asset! I guess it's a matter of taste, but all of my fave platformers (in fact most of the famous ones I can think of!) have arc jumps instead of spikes. Is there any chance that you could add this as an option for Corgi? Thanks for your hard work :)
     
    jocyf likes this.
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @zink120 > Sure, I can add more options. In the meantime feel free to override the code to get the desired behaviour.
     
  20. NAiLz

    NAiLz

    Joined:
    Apr 17, 2013
    Posts:
    88
    @reuno Lol. Good point.
     
    reuno likes this.
  21. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    288
    I thought that it was an error, the jump spike is so unnatural! Tnx for the tip.
     
  22. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    @reuno
    Is it hard to add a "freeze camera" option on the current teleport system? you know, as I did on the custom script sometime ago. Had no time to try it by myself yet, sorry.
     
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Muppo > How hard it is depends on your skills. It looks pretty simple to me.
     
  24. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    You're right :D
    Hope I can give it a try this weekend. Just in case I didn't achieve it, Can I suggest it for a future update?
     
  25. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Muppo > You absolutely can :)
     
  26. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Has anyone used a successful pathfinding system for AI with the Corgi Engine? Would love to chat in more detail if you have.
     
  27. rbagao

    rbagao

    Joined:
    Feb 13, 2016
    Posts:
    19
    Anyone encounter this?

    I'm using the latest version of Unity (Version 2017.03 0f3)
    Choose LevelSelection Scene then Run.

    And I got this error

    Assets/CorgiEngine/Common/Scripts/Tilemaps/2dExtras/Tiles/Rule Tile/Scripts/RuleTile.cs(9,15): error CS0101: The namespace `UnityEngine' already contains a definition for `RuleTile'
     
  28. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @rbagao > Well as that error tells you, it looks like you have two versions of RuleTile.cs in your project.
    Just remove one :)
     
  29. rbagao

    rbagao

    Joined:
    Feb 13, 2016
    Posts:
    19
    thanks reuno, I just figured it out as well.
    I was trying the 2D gamekit in the same project with corgi engine and that causes the problem :)
     
  30. joechancey

    joechancey

    Joined:
    Sep 2, 2013
    Posts:
    3
    I purchased this asset and I have a question, if I wanted my player to face the opposite direction after jumping off a wall, how would I do that? The way to corgi engine is set up, when you're clinging to a wall and jump off, when you jump off the wall you're going to be facing the wall you jumped off of. But I would like my player to face the opposite direction.

    Example.) You're clinging on a wall that's on the left, and you jump off and you're facing right rather than left still
     
  31. NAiLz

    NAiLz

    Joined:
    Apr 17, 2013
    Posts:
    88

    @mimminito, I use A* Pathfinding. Here's a good place to start:
     
    reuno and luigi7 like this.
  32. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @joechancey11 > By default you'll face the input direction. Feel free to create a new ability to implement your specific behaviour, that'd be the easiest way to do it, all the methods (Face, etc) are there already, shouldn't be hard :)
     
  33. LaurieCF

    LaurieCF

    Joined:
    Jul 8, 2013
    Posts:
    10
    Thanks for the reply :) Alas, I'm no coder, which is the main reason that I bought Corgi! I'm trying to learn though (with the help of your excellently commented code!), so could you or any other kind souls here please give me a hint of how I would go about this? Is it something to do with _controller.SetVerticalForce(0); in line 157 of CharacterJump.cs? Thanks in advance for any advice!
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @zink120 > No, it doesn't have anything to do with that line. I'm afraid I can't code that for you. I can put it on the todo list, but it's quite specific, so it's not gonna be high priority. I'd suggest looking at a few entry level tutorials maybe, if you're willing to get into code.
     
  35. iRYO400

    iRYO400

    Joined:
    Jan 11, 2017
    Posts:
    10
    Hey, @reuno!
    Can you please tell me, how can I add different shoot methods? Espessially for mobile
    For now, I dont understand how does touch trigger 'WeaponUse()' method
     
  36. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @iRYO400 > I'm not sure I understand your question. The buttons are bound to the character's abilities. All that is explained in details in the documentation, I suggest you have a look at it first. If something's not clear after that I'll be happy to help.
     
  37. knuppel

    knuppel

    Joined:
    Oct 30, 2016
    Posts:
    97
    Would you recomment to set up multiple levels in one scene or one scene for every level?
     
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @knuppel > It really depends on your levels, and what you're after. In general (there are always exceptions) I'd say :
    - multiple levels, one scene : harder to maintain, worse performance, but no loading between levels, I'd use it for stuff like rooms inside one common "level", like the ghost levels in super mario world for example, or a secret tiny level within a bigger level.
    - one scene per level : easier to maintain, better performance, loadings between scenes, I'd use that for most situations.
     
  39. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    Added a couple of options to teleport system I was missing



    Custom Camera Target
    overrides camera destination point and Freeze Camera disables camera following player.
    Best results comes when both are set together.

    Here's how if you're interested.

    On Teleporter.cs
    Code (CSharp):
    1. [Header("Extra effects")]
    2. public Transform customCameraTarget;
    3. public bool FreezeCamera = false;
    4. protected Transform customCameraTargetValue;
    inside the Start() funtion
    Code (CSharp):
    1. if (customCameraTarget)
    2. {
    3.   customCameraTargetValue = customCameraTarget;
    4.   var temp = customCameraTarget.transform.position;
    5.   customCameraTargetValue.transform.position = new Vector3 (temp.x, temp.y, -10);
    6. }
    7. if (FreezeCamera)
    8. {
    9.   if(!customCameraTarget)
    10.   {
    11.     Debug.Log("A custom target is mandatory. Could be an empty game object");
    12.     FreezeCamera=false;
    13.   }
    14. }
    inside the TeleportEnd() funtion
    Code (CSharp):
    1. if (customCameraTarget)
    2. {
    3.   LevelManager.Instance.LevelCameraController.customTargetValue = customCameraTargetValue;
    4.   LevelManager.Instance.LevelCameraController.TeleportCameraToPoint ();
    5.   if (FreezeCamera)
    6.   {
    7.     LevelManager.Instance.LevelCameraController.FollowsPlayer = false;
    8.   }
    9. }
    On CameraController.cs
    Code (CSharp):
    1. [HideInInspector]
    2. public Transform customTargetValue;
    then create a new funtion:
    Code (CSharp):
    1. public virtual void TeleportCameraToPoint()
    2. {
    3.   this.transform.position = customTargetValue.position;
    4. }
    I found these changes useful for small rooms, shops and stuff like that, as commented on the last post.

    Edit: forget to paste start funtion code. Sorry.
     
    Last edited: Feb 18, 2018
  40. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    288
    Thanks for the tip!
    You know you can actually create new derived scripts from the originals, so you don't have to modify the original scripts at all (in most cases). Doing that way you only create new override function xxxx() from the original the virtual function xxxx() you need.

    You do that so you can update corgi to future releases knowing you haven't touched the asset original scripts.

    Edit: Creating my new scripts using your Teleport enhacement code... it's great!
     
  41. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    Yes, I know I can and, in fact, @reuno recommended this himself but I'm not fully understand how to override yet. Sorry.
    First attemp on this was on 4.2 and it was an extension, is here just a few pages before if you want to see it.
     
  42. rbagao

    rbagao

    Joined:
    Feb 13, 2016
    Posts:
    19
    Hi guys, I am having a hard time adding functionality to the mobile controls.
    What I want is if I am in the zone of a certain image then I press B or A, the portal will be shown.
    I can implement this if the input is keyboard, but having a hard time using Input Manager.
    Any tips on how I can do this?

    This is the code for keyboard

    Code (CSharp):
    1.  
    2. public class Switch: MonoBehavior {
    3. public GameObject portal1;
    4. public GameObject portal2;
    5.  
    6. void Start(){
    7. portal1.SetActive(false);
    8. portal2.SetActive(false);
    9. }
    10.  
    11. void Update(){
    12. if(Input.GetKeyDown(keycode.Z)){
    13. portal1.SetActive(true);
    14. portal2.SetActive(true);
    15. }
    16. }
    17.  
     
  43. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @rbagao > Check out the documentation, it's all explained. You just have to bind your methods to the buttons, standard Unity stuff.
     
  44. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    288
    For example Teleporterv2 using as base the original Teleporter, is something like this:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using MoreMountains.Tools;
    5. using MoreMountains.MMInterface;
    6. using MoreMountains.CorgiEngine;
    7.  
    8.  
    9. [AddComponentMenu("Corgi Engine/Environment/Teleporterv2")]
    10. public class Teleporterv2 : Teleporter {
    11.  
    12.     [Header("Extra effects")]
    13.     public Transform customCameraTarget;
    14.     public bool FreezeCamera = false;
    15.     protected Transform customCameraTargetValue;
    16.  
    17.  
    18.  
    19.     /// <summary>
    20.     /// On start we initialize our ignore list
    21.     /// </summary>
    22.     protected override void Start()
    23.     {      
    24.         base.Start ();    // Execute original Start on original teleporter script!!!
    25.  
    26.         // My Code...
    27.         if (customCameraTarget)
    28.         {
    29.             customCameraTargetValue = customCameraTarget;
    30.             var temp = customCameraTarget.transform.position;
    31.             customCameraTargetValue.transform.position = new Vector3 (temp.x, temp.y, -10);
    32.         }
    33.         if (FreezeCamera)
    34.         {
    35.             if(!customCameraTarget)
    36.             {
    37.                 Debug.Log("A custom target is mandatory. Could be an empty game object");
    38.                 FreezeCamera=false;
    39.             }
    40.         }
    41.     }
    42.  
    43.  
    44.     protected override IEnumerator TeleportEnd()
    45.     {
    46.         //base.TeleportEnd (); This line is the same that copying & pasting all the original Teleporter code...
    47.  
    48.         // Original code -->
    49.         if (FadeToBlack)
    50.         {
    51.             if (TeleportCamera)
    52.             {
    53.                 LevelManager.Instance.LevelCameraController.FollowsPlayer = false;
    54.             }
    55.             MMEventManager.TriggerEvent (new MMFadeInEvent (FadeDuration));
    56.             yield return new WaitForSeconds (FadeDuration);
    57.             if (TeleportCamera)
    58.             {
    59.                 LevelManager.Instance.LevelCameraController.TeleportCameraToTarget ();
    60.                 LevelManager.Instance.LevelCameraController.FollowsPlayer = true;
    61.  
    62.             }
    63.             MMEventManager.TriggerEvent (new MMFadeOutEvent (FadeDuration));
    64.         }
    65.         else
    66.         {
    67.             if (TeleportCamera)
    68.             {
    69.                 LevelManager.Instance.LevelCameraController.TeleportCameraToTarget ();
    70.             }  
    71.         }
    72.         // End Original code <--
    73.  
    74.         // My new Code
    75.         if (customCameraTarget)
    76.         {
    77.             LevelManager.Instance.LevelCameraController.customTargetValue = customCameraTargetValue;
    78.             LevelManager.Instance.LevelCameraController.TeleportCameraToPoint ();
    79.             if (FreezeCamera)
    80.             {
    81.                 LevelManager.Instance.LevelCameraController.FollowsPlayer = false;
    82.             }
    83.         }
    84.     }
    85.  
    86. }
    87.  
     
    Ronnie-Grahn, Muppo and reuno like this.
  45. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    Will give it a try in a few minutes. Thank you!

    Forgot to edit this. Your script works like a charm as long as CameraController.cs have the new lines. Thanks again.
     
    Last edited: Feb 18, 2018
  46. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    265
    Hello =D, just wondering, is there a way (like in Rayman legends/origins) that when the character jumps and press again the jump button, the character will fall down slowly, and when release the button this will fall normally ?
     
  47. WFultonCTI

    WFultonCTI

    Joined:
    Jul 3, 2017
    Posts:
    1
    Forgive me if this has already been asked, but when trying to build my project I get stuck on "Packaging Assets - resources.assets". Is there a known fix for this? Initially I thought it was just taking a long time but it didn't make any progress after 10ish minutes. Thanks in advance for any help.

    EDIT: Nevermind... I'm just an impatient idiot lol...
     
    Last edited: Feb 20, 2018
    reuno likes this.
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Fultron1218 > Nevermind then :)
    @CHEMAX3X > Not something that's built in right now, but you could look at the jetpack for inspiration, it's close enough.
     
  49. Magixapps

    Magixapps

    Joined:
    Mar 4, 2017
    Posts:
    55
    Hi,
    i have buy 'Corgi Engine' its perfect , but for my other project i want take system 'pixel perfect' who is in ( MinimalPixelPerfect ).
    What line on what script for take that pixel perfect system?
    Thank you!
     
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @BOOapp > Sorry but it's not just one line or one script, it's a bunch of things.
    But mostly you'll want to look at the CameraController, that's where most of the magic happens.