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. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
    Another thing, could the score system be used as some kind of currency with the rex features?
     
  2. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
    One last thing, could you guide me into the super meat boy physics with rex engine features?
     
  3. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Yup, sure can!
     
  4. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Off the top of my head, the Rigidbody collision settings shouldn't have anything to do with the player colliding with terrain; that's all done via raycasts, and the Rigidbody settings are just used to process any OnCollision or OnTrigger events you have in your scripts. Is this a one-way platform you're talking about? If so, I'd recommend not using TileMaps for the one-way platforms, and just making them objects. (You can still use TileMaps for all totally solid terrain!)

    Potentially, if you're so inclined. You can query the score with this:

    Code (CSharp):
    1. ScoreManager.Instance.score
    You can increment or decrement the score as follows:

    Code (CSharp):
    1. ScoreManager.Instance.IncrementScore(1);
    2.  
    3. ScoreManager.Instance.DecrementScore(1);
    The "1" there can be any number; it's just how much you're adding or subtracting by.

    I might need you to be a bit more specific on this one. What aspects of the physics? Here are some videos on Rex physics that might help:




    For really tight physics, I'd recommend making sure there's no acceleration or deceleration. You'll probably find most of what you need on the Controller child object of your player, under the MovingState and JumpState components.
     
  5. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
    Nailed the physics with your mario tutorial! Thanks. However im still concerned about the collision. I am not using one way platforms, just solid terrain with some walls that emerge from the ground itself, so it is all connected. The issues with the collision mostly happens when the character is knocked when hit
     
  6. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Can you paste a screenshot of the terrain, selected so I can see the green outline of the collider? This would be the first time I've ever encountered an issue like that, so it's probably something we can figure out.
     
  7. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
  8. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Hey @BeeZee, just to be 100% sure, Rex doesnt work with 3D colliders right ?, cuz i took the decision that my game will be 2.5D, but as soon as i put a 3D collider, the player passes through like if the 3D object has no collider attached =O
     
  9. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Hm... off the top of my head, that looks totally fine. Can you upload your project and PM me a link to it? I'll take a look at it and see if I can troubleshoot.
     
  10. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Yep, 2D colliders only. Assuming the 3D is mostly a graphical style, you should be able to use 3D graphics with 2D colliders, though, and that should work fine.
     
    CHEMAX3X likes this.
  11. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Alright then !! thanks a lot (=
     
    BeeZee likes this.
  12. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
    I think I worked the colliders out. Anyway, thanks for the help and if the problem continues to appear I will send you the project.

    Off Topic: Any news/info on the AI system? haha, I was about to buy playmaker to create complex enemies but when I read you were developing an AI system i thought that maybe that will be good enough
     
    BeeZee and CHEMAX3X like this.
  13. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Ah, cool! I'm curious -- do you know what it was?

    And yep, lots of news for the AI system. It's at a point now where pretty much everything works properly, and now I'm doing some testing and making some custom UI for it so it's really friendly to use. It's getting really close!

    My litmus test right now is, "Can this system create Mega Man-style bosses directly from the Inspector?" To that end, I've been building a bunch of test cases. Here's what I'm working on today:


    · Moves left and right, turning when it hits a wall OR at random intervals around the arena.

    · Sporadically performs attacks – either a projectile if the player is far away, or a melee if the player is close. Faces the player before doing the attack.

    · At the point where its health hits 50%, its routine changes slightly.

    · It now jumps around the arena with a sequence: jump, land for a couple seconds, attack while on the ground; jump again. It will turn when it hits a wall. All of its jumps will move in the direction of the player.

    · It gains a third attack: for this attack, it jumps very high, to the center of the arena, and fires several larger simultaneous projectiles downwards at random angles.

    I've built out a few of these now, and they've been really good for showing me where I need to keep fleshing out the system. I think this particular one should be doable with features that already exist, but I'll keep you guys posted! I'm also considering bundling some of these guys in with Rex as samples, and of course I'm figuring out what types of videos and tutorials I want to do for all of this.

    Also, I'm planning to do a small beta before the official release, so (this goes for anyone) shoot me a PM if you'd like to be involved!
     
  14. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Can't wait >u< !! and as i told you, i'd be happy to be a beta tester (=
     
    BeeZee likes this.
  15. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Yep, you're on the list! I appreciate it.
     
    CHEMAX3X likes this.
  16. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Today's fun AI feature reveal: enemy movements are getting waypoints! So you can do fun things like set up this type of sequence, for example:

    • Enemy moves to (-10, 0)
    • Enemy stops, faces player, and fires a projectile at them
    • Enemy moves to (7, 0)
    • Enemy jumps
    • Enemy moves to (12, 0)
    • Enemy waits for 1.5 seconds
    • Repeat

    I hadn't even planned to make them this in-depth originally, but now that I'm testing them, I'm really excited!
     
    CHEMAX3X and Lars-Steenhoff like this.
  17. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
    Thanks a lot, really! Im really excited to test that out!
     
  18. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
    Im sorry about this question but, can anyone tell my why I cannot change the Door prefab values? Its in a grey color and blocked. I cannot change a thing about it.

    Thanks in advance!
     
  19. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Is your Rex Level Editor window open? (You can access it via Window > Rex Engine > Rex Level Editor.) And if so, is the "Lock Rex GUI" box unchecked? If the GUI is locked, it'll prevent you from changing values on Scene Loaders, which Doors are classified as (since they load the player into a new scene when opened.) So you'll want Rex Level Editor open and docked somewhere, and Lock Rex GUI to *not* be checked, and that should let you edit the Door.
     
  20. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
    It is unchecked since always, and I can modify normal scene louders. However Doors appear to me like this: DoorPNG.png
     
  21. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Hm... so it looks like Unity isn't properly displaying all of Rex's gizmos for you for some reason. All those big white squares in your image should be appearing as specific graphics, instead. That could be related, but it's hard to say offhand.

    Out of curiosity, does opening and closing the Rex Level Editor window do anything for you? The doors *should* have the same rules applied to them as regular SceneLoaders, so if the other SceneLoaders are usable, Doors should be too, and vice versa.

    As always, if you want to upload your project and PM me a link to it, I'd be happy to take a look.
     
  22. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    For anyone else reading this, we're chatting about this over messenger at the moment. It's 100% doable; I used it for the Dracula Rex demo from last Halloween, which you can find here:

    http://www.skytyrannosaur.com/DraculaRex/index.html
     
    CHEMAX3X and duke2go like this.
  23. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Just to let you know that it has a little bug, when you finish the demo and start again, the background trees disappear

    Captura de pantalla (652).png
     
  24. duke2go

    duke2go

    Joined:
    Nov 1, 2018
    Posts:
    13
    I know BeeZee has been working on AI updates, so I have been trying for the past 4 hours to write what should have been a simple script to instantiate a projectile from a shared fire point that would go in 3 different directions like the spread shot in the Contra series. I even found code that should work, which I'll include here. After going between the scripts for Rex Pool, Projectiles, Attacks, and some other places I'm frustrated and even more confused than I should have been in the first place, especially after how many difficult things I accomplished with the Devil Hunter demo this weekend. Thanks for any help.

    This is the Script I found:

    Code (CSharp):
    1.  
    2. GameObject TBullet = Instantiate(straightbullet, put gun tip here, Quaternion.Euler(new Vector3(0, 0, 45))) as GameObject;
    3.  
    4. TBullet.GetComponent<Rigidbody2D>().velocity = TBullet.transform.right * 1f;
    5.  
    6. GameObject TBullet2 = Instantiate(straightbullet, put gun tip here, Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject;
    7.  
    8. TBullet2.GetComponent<Rigidbody2D>().velocity = TBullet2.transform.right * 1f;
    9.  
    10. GameObject TBullet3 = Instantiate(straightbullet, put gun tip here, Quaternion.Euler(new Vector3(0, 0, 315))) as GameObject;
    11.  
    12. TBullet3.GetComponent<Rigidbody2D>().velocity = TBullet3.transform.right * 1f;
    That just instantiates three bullets from the gun tip, rotates them forward, angled up and down, and then gives them velocity.
     
  25. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    No problem -- I'll write up some stuff tomorrow that should help you with this.
     
  26. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Thanks for the heads-up! I'll see what I can do about fixing it.
     
    CHEMAX3X likes this.
  27. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Hey @BeeZee, quick question, is there a way with Rex to grab, let's say rocks and throw them away to enemies like weapons ? Something similar to Mario 2 (Nes), and if not, could you guide me on where should i start.

    Also ( i know im annoying u__u ), any news about the majestic AI update >u< ?
     
    Lars-Steenhoff likes this.
  28. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    So at the moment, this will require a bit of scripting, although this is something I'd like to build straight into the Projectile settings in the Inspector in the future.

    Here's the broad overview of what I'd do here:

    • Make your own script which extends Rex's Attack component
    • Attack has a virtual void called "CreateProjectile." You can find it on line 373 of Attack.cs. Right now, it's set up to only shoot one bullet. I'd override that function. Starting on line 381, you'll see it creating the projectile itself. In your new function, you can call that three times instead of once, to create three projectiles.

    Line 396 is the line that fires the projectile. This line includes the vertical direction the projectile should go.

    Code (CSharp):
    1. newProjectile.Fire(new Vector2(slots.actor.transform.position.x + transform.localPosition.x * (int)direction, transform.position.y), startingHorizontalDirection, startingVerticalDirection, slots.actor, projectile.rexPool);
    The "startingVerticalDirection" there holds the vertical direction. You can replace that with:

    Direction.Vertical.Up
    Direction.Vertical.Down
    Direction.Vertical.Neutral

    Using one of those for each instance of the projectile you fire should make them each go in different directions.

    You may also have to edit some Inspector settings on the Attack and the Projectile itself -- particularly, the "Projectile > Is Aimable" box on the Attack component might play a factor.

    That should be the general idea. I've also got a couple Projectiles tutorials on YouTube that might clarify a bit.

    (And it's worth repeating that this is definitely something I'd like to make simpler in the future!)
     
  29. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    It'll take some scripting at the moment. It'll probably be a bit complex, but here's the gist of it:

    For your rock, I'd make a script that extends Rex's "Projectile" component. Projectile has a function called "Fire()." This is what you'll call when you "throw" your rock. You should be able to use the Projectile's Inspector settings to give it a nice arc when it's thrown, similar to how a rock would get tossed (or, if you just want it to go straight, you can do that too, of course!)

    Here's the tricky part: when the rock isn't being thrown, you'll want it to be attached to your player. You should be able to accomplish that like this (this is sort of pseudocode, but hopefully it'll illustrate the idea):

    Code (CSharp):
    1. void FixedUpdate()
    2. {
    3.      if(isPlayerCarryingThis && !isFiring)
    4.      {
    5.            SetPosition(new Vector2(player.transform.position.x, player.transform.position.y));
    6.      }
    7.  
    8.      if(isFiring)
    9.      {
    10.           UpdateMovement();
    11.      }
    12. }
    The bottom part -- everything in the "if(isFiring)" block -- is the standard Projectile code, which moves the projectile if it's being fired. Everything above that is new. "isPlayerCarryingThis" is a new variable you'd add to tell the rock that the player picked it up. So, in essence, that block up top is saying "if the player is carrying this, and it's not currently being thrown, set its position every frame so it's on top of the player's position." That should make the player "carry" it.

    The last step would be to use your player's OnTriggerEnter2D() method so that, when they collide with a rock, it would set "isPlayerCarrying" on the rock to "true." That should activate the above code so the rock gets "carried" by the player once they touch.

    That's just the gist of it -- you'll have to do a bit of plumbing on your own to flesh it out -- but hopefully that helps!

    AI is going well, thanks for asking! I was planning to post some new screenshots this week, but I'm in the middle of moving to a new house and that's been draining a lot of time. (Let me tell you, these hands are good at programming but not as good at lifting heavy furniture, haha!) Rest assured it's getting close, though! I'm very, very excited for everyone to finally see this.
     
    CHEMAX3X likes this.
  30. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Heya all, just wanted to let everyone know I'm all moved in and back to work. I'm planning to put out a mini-update for Rex soon with some smaller new features and bug fixes I've done in the background over the past couple months, and then the next thing should be AI. Lots of cool stuff is on the way!
     
    CHEMAX3X and Lars-Steenhoff like this.
  31. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Hey @BeeZee, quick question, do you know why is happening this:

    horizontalPlat.gif
    The player doesn't move with the platform, it only happens with horizontal moving platforms, and only mine, the Rex demo ones work perfectly, so i copied all the settings, but still, i don't know whats going on =O

    inspector.png
     
  32. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Thanks it works perfeclty ='D
     
  33. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Is your platform tagged with the PhysicsMover tag? Anything that alters the physics of another actor (like moving platforms, or ice, and so on) has to have that tag to function.
     
    CHEMAX3X likes this.
  34. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Solved !!! i didn't add the tag, thanks for the help =D
     
    BeeZee likes this.
  35. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Heya all, just wanted to let you know that a new version of Rex has been submitted and should hopefully be up on the Asset Store next week! This is an interim release between now and the upcoming AI update. It features some new features and bug fixes I've been working on alongside the AI stuff. I'll be detailing the update more shortly.
     
  36. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    131
    I hate to be tactless, but any plans for Rex makin' it to the black friday sales? :p Not that it isn't worth full price, of course! I just have some friends that are casual gamedevs and I'd love to get them to open their pockets to Rex during sales time ;)
     
  37. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Rex v1.35 is out today! It features a bunch of small fixes and tweaks, and the headliner is an expanded dialogue system, which lets you do multi-page dialogue boxes! You can check out a tutorial here:

     
    Zebbi and CHEMAX3X like this.
  38. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Yep, there'll be a sale starting next Monday.
     
    Zebbi likes this.
  39. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
    Heya! I updated the asset in the asset store window and import it and seems like I have compile errors. Also, Rex engines stopped working and my game is just Unplayable lol. It is probably a noob and easy fix mistake but, can anyone help me? upload_2018-11-20_12-15-47.png
     
  40. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Ugh, sorry about that! That's a thing that really annoys me with how Unity handles its asset update process. The red error in the screenshot basically means that it sees two of the "EnemyAI.cs" scripts, so it's confused about which one to use.

    You should be able to fix it by going into the Project panel, doing a search for "EnemyAI", and then deleting (either) one of the two copies of the script you'll probably find there.

    So what it looks like happened here is: I moved the EnemyAI script to a different folder (in preparation for the upcoming AI update.) Unity's asset updater isn't smart enough to know when a file moves, so it treats the "moved" version of EnemyAI as a separate file -- and you end up with duplicates, which Unity then sees as an error.

    Can you let me know if the above fix does the trick? I imagine other people will run into the same issue, so it'll be good to have the solution posted here. Apologies again, and thanks for posting the screengrabs here!
     
    CHEMAX3X likes this.
  41. RushingEntertainment

    RushingEntertainment

    Joined:
    Sep 28, 2018
    Posts:
    14
    It worked, thanks a lot. I will have to mess around again with the post processing fx and camera configuration as it seems like it returned to it's original values. Im not bothered about that, in fact I was going to do all that again, but maybe it is useful information for another user.
     
  42. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Thanks for this, i had the same problem when updating Rex
     
  43. duke2go

    duke2go

    Joined:
    Nov 1, 2018
    Posts:
    13
    CONGRATULATIONS on the Update release!!!
    I'm very glad I came here today to check up on things. I'm excited about the new enemy AI. I wanted to create a boss enemy for the end of the Devil Hunter Level 1 that was a mix of the Sigma battle at the end of Megaman X (1) and the giant cyber skeleton bosses from Contra 3. Basically I was incorporating a Yokai from Japanese mythology that is a giant skeleton that appears in areas where great losses of life have occurred. So I wanted the boss to appear from the ground kind of like the Contra 3 boss


    I was thinking of giving him a directional attack and putting a jewel either in its forehead or in its chest that the player will have to attack to injure the boss. I'm glad you included the "change behavior at 50%" because I was already trying to figure that part out. The idea I have is to have the boss come up and down during the fight and either shoot fireballs at the player or try to squash them with its claws. (like Sigma)


    Ideally, I want to make it so the player can't hit the weak point from the ground normally, but they can ride the fists/claws back up like the end of Megaman X. If they get hit by the swipe of the claws they receive damage and if the claws miss, they get stuck in the soil for a minute giving the players a chance to hop on the back of the hand as a platform. I was originally thinking of designing this as 3 separate enemies and make only 1 of them able to be injured (ideally the head/weak point). I figured the "follow player" function would work for the claws. I wasn't so sure about the fireballs though since checking "isAimable" for enemies seems to spawn the projectile above the enemies rather than aiming towards the player. Don't know if you updated that in what you just put out, but if you hadn't heard of the problem I wanted to let you know. Was just discussing ideas but any insight into boss design wouldn't be turned away!! Looking forward to trying out the new update! Keep up the great work.
     
  44. duke2go

    duke2go

    Joined:
    Nov 1, 2018
    Posts:
    13
    I also wanted to share this grappling hook mechanic that I can't get working. I think my problem stemmed from a combination of needing to assign an action slot to the grappling hook and having the mouse position qualifier in the code. I haven't the foggiest idea how to alter it to work, but I figured either BeeZee or some other adventurous programmer might be able to find the mistake and it could be incorporated into a later update.

    Here's the code for the hook;
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class grapplingHook : MonoBehaviour {
    6.  
    7.     public LineRenderer line;
    8.     DistanceJoint2D joint;
    9.     private Vector3 targetPos;
    10.     RaycastHit2D hit;
    11.     public float distance= 10f;
    12.     public LayerMask mask;
    13.     public float step = 0.2f;
    14.  
    15.     // Use this for initialization
    16.     void Start () {
    17.         joint = GetComponent<DistanceJoint2D>();
    18.         joint.enabled = false;
    19.         line.enabled = false;
    20.     }
    21.  
    22.     // Update is called once per frame
    23.     void Update () {
    24.         if (joint.distance > .5f)
    25.             joint.distance -= step;
    26.         else {
    27.             line.enabled = false;
    28.             joint.enabled = false;
    29.         }
    30.  
    31.        if (Input.GetButtonDown ("Fire3")) {
    32.             targetPos= Camera.main.ScreenToWorldPoint(Input.mousePosition);
    33.             targetPos.z=0;
    34.  
    35.             hit = Physics2D.Raycast(transform.position, new Vector2(transform.localScale.x, 1), distance, mask);
    36.  
    37.             if (hit.collider !=null && hit.collider.gameObject.GetComponent<Rigidbody2D>() !=null) {
    38.                 joint.enabled=true;
    39.  
    40.                 //Debug.Log (hit.point - new Vector2(hit.collider.transform.position.x, hit.collider.transform.position.y);
    41.                 Vector2 connectPoint = hit.point - new Vector2(hit.collider.transform.position.x, hit.collider.transform.position.y);
    42.                 connectPoint.x = connectPoint.x / hit.collider.transform.localScale.x;
    43.                 connectPoint.y = connectPoint.y / hit.collider.transform.localScale.y;
    44.                 Debug.Log (connectPoint);
    45.                 joint.connectedAnchor = connectPoint;
    46.  
    47.                 joint.connectedBody=hit.collider.gameObject.GetComponent<Rigidbody2D>();
    48.                 // joint.connectedAnchor = hit.point = new Vector2(hit.collider.transform.position.x, hit.collider.transform.position.y);
    49.  
    50.                 joint.distance= Vector2.Distance(transform.position,hit.point);
    51.  
    52.                 line.enabled = true;
    53.                 line.SetPosition(0, transform.position);
    54.                 line.SetPosition(1, hit.point);
    55.  
    56.                 line.GetComponent<ropeRatio>().grabPos=hit.point;
    57.             }
    58.        }
    59.        if (Input.GetButton ("Fire3"))
    60.         {
    61.             line.SetPosition(0,transform.position);
    62.         }
    63.         if (Input.GetButtonUp ("Fire3"))
    64.         {
    65.             joint.enabled = false;
    66.             line.enabled = false;
    67.         }
    68.  
    69.     }
    70. }
    71.  
    And here's the code for the rope mechanics;

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class ropeRatio : MonoBehaviour {
    6.  
    7.     public GameObject player;
    8.     public Vector3 grabPos;
    9.     public float ratio;
    10.  
    11.     // Use this for initialization
    12.     void Start () {
    13.      
    14.     }
    15.  
    16.     // Update is called once per frame
    17.     void Update () {
    18.  
    19.         float scaleX = Vector3.Distance(player.transform.position, grabPos)/ratio;
    20.         GetComponent<LineRenderer>().material.mainTextureScale = new Vector2(scaleX, 1f);
    21.     }
    22. }
    23.  
    Like I said, I think it has something to do with the inputMousePosition qualifier, but I don't really know. And I wanted to share it in case it helped with expanding the Rex Engine or helped another programmer with their own project. I hope it was worth sharing =-)
     
  45. CHEMAX3X

    CHEMAX3X

    Joined:
    Jan 8, 2018
    Posts:
    231
    Hey @BeeZee , is there a way to activate dialogues with a button instead ? Now is activated once you enter to the trigger collider, but i was planning to use them on NPCs and/or signs. Also, could it be possible to add animations while the dialogue is being showed ? for example on NPCs like if they were talking and so on.

    Thanks n__n'
     
  46. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    I'd love to do an update with a bigger NPC update, for sure.

    In the meantime, you can call this from anywhere to bring up a dialogue box:

    Code (CSharp):
    1. DialogueManager.Instance.ShowRawText(string _text);
    You can pass that any text you'd like, and it'll bring up a dialogue box using that. So what you can do is put a collider on your NPC, and then check to see if they're colliding with the player and if the player is pressing "Up" (or whatever button you'd like), and if so, you can show the dialogue like above.
     
  47. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Hope everyone had a great holiday! Rex Engine is having a Cyber Monday sale for half-off right now. Enjoy!
     
  48. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    131
    What's the easiest way of adding a camera or post-processing effect to the whole game? I've been meaning to try a CRT effect with Rex for ages and I'm not entirely sure what the best approach would be for this, since Rex appears to create the cameras at runtime?
     
  49. duke2go

    duke2go

    Joined:
    Nov 1, 2018
    Posts:
    13
    I have a simple question. How do I add either a particle effect or a secondary animation to the Dash state? I tried to replicate the landing particle of the landing state, but when I tried to add the particle effect it wouldn't accept the additional code? I just wanted to add an effect that played where the player dashed from, like a "woosh" of air. I thought initially I could add a Secondary animation, but it gave me trouble. So I tried to initialize a particle effect instead, like the landing particle, when the player started to dash, but still can't get it to work. I added this to the dash string

    Code (CSharp):
    1.      
    2. [Tooltip("If slotted, this RexParticle will play when the actor dashes.")]
    3.         public RexPool dashingParticlePool;
    4.         [Tooltip("If Dashing Particle Pool is slotted, this lets you adjust the positioning of the landing particle.")]
    5.         public Vector2 particleOffset;
    I put this after the isDashing initialization
    Code (CSharp):
    1.   if (dashingParticlePool && controller.slots.physicsObject.GetSurfaceTag() != "Stairs")
    2.                     {
    3.                         SpawnDashingParticle();
    4.                     }
    And this after the last bit of code at the bottom
    Code (CSharp):
    1.   protected void SpawnDashingParticle()
    2.             {
    3.                 GameObject particle = dashingParticlePool.Spawn();
    4.                 ParentHelper.Parent(particle, ParentHelper.ParentObject.Particles);
    5.                 particle.transform.position = new Vector3(dashingParticlePool.transform.position.x + particleOffset.x, dashingParticlePool.transform.position.y + particleOffset.y, 0.0f);
    6.                 particle.GetComponent<RexParticle>().Play();
    7.             }      
    Sorry for the dumb questions. I'm really trying to learn by doing what I consider simpler things, but I feel like I'm bashing my head against a wall no matter what I try to do...

    Thanks for any input
     
  50. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    402
    Rex will create cameras from the prefab here:

    RexEngine/Resources/System/Cameras

    If you drag that prefab out to the stage, you'll see that you can expand it, and it has several cameras inside, corresponding to different layers of parallax (and the UI.) If you click on any of the children -- say, MainCamera -- you'll see a standard Unity Camera component on it in the Inspector. Feel free to drag post-processing components onto those, and they should work fine. (I've been using the Blur effect in a project of mine, and I love how it looks!)