Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[RELEASED] Rex Engine: A Unity 2D Platformer Engine

Discussion in 'Assets and Asset Store' started by BeeZee, Jun 20, 2017.

  1. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    62
    Kewl:cool: Thanks for the share man, keep up the good work:) Nice game you're working on, got that SHINOBI VIBE look, love it;)
     
  2. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    62
    Already Drooling with Excitement :p
     
  3. RainbowWhale

    RainbowWhale

    Joined:
    Feb 25, 2018
    Posts:
    20
    I added InControl in engine, and now I can not change the control keys on the keyboard in Input. How do I do it now? And one more question. I want to add actions when taking or causing damage, in which functions to code them (for player and enemy)?
     
  4. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Heya,

    InControl requires you to do some minor script editing to change its inputs. You can find that under RexPlayerActionSet.cs. Starting on line 41, you'll see different commands being mapped to InControl actions. Here's the Jump code, for example:

    Code (CSharp):
    1. playerActions.Jump.AddDefaultBinding( Key.Space );
    2.             playerActions.Jump.AddDefaultBinding( Key.H );
    3.             playerActions.Jump.AddDefaultBinding( InputControlType.Action1 );
    This is setting Jump to be used with the Space key, the H key, and InControl's Action1 button. If you go down the list, you'll see all the other Rex actions as well.

    To script extra effects when something gets hit, you'll want to look at RexActor.cs. Both the Player and any enemies are already using RexActor, so you can extend that class to make your custom player/enemy class. Then, you'll want to override this method:

    Code (CSharp):
    1. protected virtual void OnHit(int damageTaken, Collider2D col = null){}
    This exists on RexActor, and is called automatically every time the RexActor gets hit. It will also tell you how much damage they took, and it'll pass in the Collider of the object that hit them, in case you want to query any properties from it. So, your version would look like this:

    Code (CSharp):
    1. protected override void OnHit(int damageTaken, Collider2D col = null)
    2. {
    3.      //Your extra effects go here
    4. }
    Hope that helps!
     
  5. RainbowWhale

    RainbowWhale

    Joined:
    Feb 25, 2018
    Posts:
    20
    I have some problems with Dash state:
    1. I use "Can Start Dash In Air", and it doesn't work when I Dash from the edge of the platform
    2. I can't Dash while sliding on the wall
    3. After Dash In Air, the player falls to the ground faster than after the jump. It looks a bit unnatural. (And when stepping off the platform.)
    Can I change it myself? I do not require, but it would be nice to have access to such options in the inspector
    Also, it would be cool to add an option that adds an action for the player when falling from a certain height (animation, taking damage, temporary disabling the control)
    Thank you for listening!
     
    Last edited: Jan 14, 2019 at 5:18 AM
  6. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    1,807
    some nice video for castlevania fans, how a whip works

     
  7. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    1. Can you clarify what you mean on this one?

    2. I just checked, and you're correct! I'd like to add this feature -- I'll try to get it in there in an update soon!

    3. Hm... I tested this, and it looks like what's happening is, the player hits their maximum fall speed immediately when a dash ends, whereas with a jump, because they were previously moving upwards, the upward momentum means it takes a few frames for gravity to fully take over and move them at their maximum downward speed. I hadn't thought about this before, but I agree that it looks a bit weird. Thanks for pointing it out! I'll look into it.

    For the fall damage thing, check out Landing State. That has a field called "Fall Distance for Stun." If it's set to 0, it will be deactivated. However, if you set it to anything above 0, then your player will be stunned when they land from any height greater than or equal to the number you set. There's a slot called "Stunned Animation" which will let you play an animation, and they'll also be unable to move for as long as that animation is playing.
     
  8. RainbowWhale

    RainbowWhale

    Joined:
    Feb 25, 2018
    Posts:
    20
    dash.png
    Thank you for help!
     
  9. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Ah, gotcha. Thanks for the diagram!

    I'll investigate that this week. I'll keep you posted here, and send you an update to test once I've got it worked out.
     
  10. RainbowWhale

    RainbowWhale

    Joined:
    Feb 25, 2018
    Posts:
    20
    Can I ask a question? I tried to add in new script my own method (DOTween animation) for a moving platform, and everything is moving except for the BoxColider. I just need the platform to move with the player, but if I use DOTween, the BoxColider remains hanging in the air when the platform starts moving.
    If I understand correctly, the point is some function from RexPhysics. If it is not hard for you, can you tell me what method I need to fix in RexPhysics for this?
     
  11. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    I suspect that probably won't work, at least for the time being. The moving platforms use RexPhysics both for their own movement and to tell any actors riding on them where to position themselves, so if you moved them with DOTween, things riding on them wouldn't move properly.

    The good news is, the upcoming AI update has a waypoints system where enemies can be set to move between any number of different waypoints you define. Once the AI update is out, I'd like to implement the same thing for moving platforms.
     
    lordnasty likes this.
  12. RainbowWhale

    RainbowWhale

    Joined:
    Feb 25, 2018
    Posts:
    20
    So we still have a chance? It seemed to me that it is not so difficult, just need to fix something in the script. Anyway, thanks for the quick feedback. I think I can make the game, what I want, with your engine.
     
  13. FunkyBuddha

    FunkyBuddha

    Joined:
    Aug 17, 2017
    Posts:
    62
    @BeeZee

    Just want to ask if there's a feature in Rex on the loot drop, somewhat similar to Castlevania, like after killing an enemy it spawn an item, slightly jumps and slowly bounces and settle on the ground then flashes for a few seconds and disappears. The other one is the Drop Loot Auto Flyback to the player.
     
  14. RainbowWhale

    RainbowWhale

    Joined:
    Feb 25, 2018
    Posts:
    20
    I would also like this feature. It would be cool if the loot flew in the direction from which the enemy was killed.
    Sometimes it seems to me that we ask a lot :)