Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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

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

  1. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    Hi guys. Tell me please what is the correct approach to move from one scene to another. I mean for example I have a game over screen and I need to load level by button click. How can I do that?
     
  2. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    If somebody also will need this information then I leave this small tutorial here.
    First of all need to create new script, some kind of "UI actions" and this script should be inherited from Rex Level Script like this

    Code (CSharp):
    1. public class UiActions : LevelScript
    2.  
    Then create the function for button click action and use methods and variables form the inherited class like in code below:

    Code (CSharp):
    1. public void OpenSomeScene()
    2.     {
    3.         loadNewScene.sceneToLoad = "Scene_Name";
    4.         ExitScene();
    5.     }
    And voila. I hope this will be useful for somebody.
    Full Class code:
    Code (CSharp):
    1. public class UiActions : LevelScript
    2. {
    3.  
    4.  
    5.     protected override void OnExitScene()
    6.     {
    7.         ResetData();
    8.     }
    9.  
    10.     public void GoToScene()
    11.     {
    12.         loadNewScene.sceneToLoad = "Scene_Name";
    13.         ExitScene();
    14.     }
    15. }
     
    Lars-Steenhoff likes this.
  3. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    Hey guys. I have a problem. I'm using Rex + pro camera 2d and I have an issue. I set the camera size to 10 and it works perfectly if load the scene directly from the unity but if I move to the title screen and back to the level screen then my camera size is automatically set to a 7.6 value. I already tried everything but can't understand why is it happening. Any ideas?
     
  4. thenadamgoes

    thenadamgoes

    Joined:
    Apr 26, 2019
    Posts:
    29
    Is anyone out there still using Rex Engine?

    Is there an easy way to save object states between scenes? Like if my character moves a block around...can I save where the block is instead of having it reset each time I leave and enter the scene?

    There is Object Disabler, but that just seems to keep enemies and collectables destroyed.
     
  5. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    You need a special library for this functionality. Some kind of Easy save. There are you will find autoSave functionality which should resolve your issue. And maybe Rex Engine is not the best solution for games like this. Rex Engine fit mostly for classic platformers and classic metroidvanias. Maybe you should try something like Corgy (I don't like this engine) or something else. In case with Rex I think you will need to rewrite some code in the respawn logic.
     
    Last edited: Oct 7, 2021
  6. thenadamgoes

    thenadamgoes

    Joined:
    Apr 26, 2019
    Posts:
    29
    Thanks for the response! I'm actually trying to make a basic classic metroidvania, I just wanted to be able to open some doors and keep them open when I come back. I'm sure eventually I can figure something out (I'm really new to Unity in general).

    I actually tried out Corgi, but it just does so much extra stuff - I couldn't figure out how to do this is corgi either lol.

    Thanks again! I'm glad someone is still keeping up with Rex.
     
    denisnasi likes this.
  7. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    Player, it is prefab. If you have some new ability that should be enabled then you can edit prefab directly instead of scene instance. You need to create a public object inside your component that responds for ability activation and put the player prefab there. And when you need to unlock the ability you need to unlock this ability inside prefab but not inside scene instance. That's it. This solution should resolve your issue.
     
    Last edited: Oct 8, 2021
  8. thenadamgoes

    thenadamgoes

    Joined:
    Apr 26, 2019
    Posts:
    29
    Does anyone know if there is a way to make it so enemies will only be damaged by 1 type of attack but not another? Like if an enemy can be damaged by the melee attack, but not the projectile attack.
     
  9. Galllaa

    Galllaa

    Joined:
    Aug 23, 2015
    Posts:
    6
    Hi, is it possible to get the Rex Engine somehow pls? I would relly like to try it out. Im not a fan of Corgi Engine or PRO Platformer 2d.
     
    ggpereira likes this.
  10. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    68
    No you can't. The Author should post this Package again online.
    Here or any other asset store.
    I know corgi engine is heavy but it have more features than rex, also rex is not updated anymore.
     
    Last edited: Jan 25, 2022
  11. tiz777

    tiz777

    Joined:
    Jan 20, 2010
    Posts:
    93
    Just fixed a bug in RexPhysics that happens very rarely, hope it can be useful to someone else too.
    To be honest can't really say why it happens, but this solved my crashes when pushing two blocks (one over the other) in a particular situation.

    Just added this if statement to avoid a division by zero, around line 1560 in RexPhysics:

    Code (CSharp):
    1.                         if (slopeOffsetThisFrame == 0)
    2.                         {
    3.                             percentageMoved = 0;
    4.                         }
    5.                         else
    6.                         {
    7.                             percentageMoved = Mathf.Abs(adjustedSlopeOffsetThisFrame) / Mathf.Abs(slopeOffsetThisFrame);
    8.                         }
    9.  
     
    Lars-Steenhoff, Bagnol and OscarLeif like this.
  12. thenadamgoes

    thenadamgoes

    Joined:
    Apr 26, 2019
    Posts:
    29
    Does anyone know how to enable double jump with the switch button?

    The world action component allows you to enable abilities, but it only lets you turn jump on and off, not add double jump to your jump.
     
  13. tirkaroKujo

    tirkaroKujo

    Joined:
    Jul 10, 2017
    Posts:
    10
    i know that trying to get an answer on this depreciated framework in the current day is definitely a dead end, but the only thing holding my game back at the moment is that I have no idea how to fix the ladder/ladder state script so that it doesn't drop you down automatically in a helpless state if you climb down it from the top.
    I feel like its a very easy fix but my coding knowledge is way too limited still lol.
     
  14. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    Sorry @tirkaroKujo, are you still having this ladder issue? I jumped in and took a look at how the ladder behaves and I'm not sure what you're referring to. What are you trying to make the character do?
     
  15. duke2go

    duke2go

    Joined:
    Nov 1, 2018
    Posts:
    15
    Well I missed a LOT in the past few years...

    Not that anybody is probably even going to read this but I'm going back into development for Devil Hunter - Miyumi and I never got an answer to 2 questions I had years ago.

    1. Did anyone ever answer how to set up a spread shot projectile like in Contra? BeeZee was supposed to post a reply for me, but that was literally days before I became homeless...

    2. Is there any way to offset the camera to stay a certain distance above the player? I had a problem where the camera would be too low and it would show too much of the ground and looked wrong. A scene boundary that was vertical would probably even work.

    Glad to see that everyone kept supporting the project after it was put to pasture. I still plan on using it. Hope y'all will too.

    God bless.
     
  16. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    My apologies for the delay @duke2go - I don't check this thread very often anymore because of the lack of activity.

    The easiest way to set up a split shot is to have multiple weapons enabled at once, loaded with variants of the same projectile. Rex will fire every weapon that has the "Is Enabled" box checked at once when you shoot. For the upwards projectile just set the Projectile component's Y Movement Speed value to something like 5, and for the downwards projectile set the Y Movement Speed to something like -5.

    As for the camera issue though I'm not sure unfortunately - I replaced Rex's camera system with ProCamera2D pretty much immediately.