Sliding Doors and Lighting Lights

0 favourites
  • 4 posts
From the Asset Store
The package contains 105 sounds This sound library is perfect for voicing mechanical doors in your Sci-Fi game.
  • Regarding the lights part first:

    I have a system set up where if you approach a wall, the texture will change to show that it has lit up. It works, but I want it to work for every member of a family, which means that any character will light up a wall when they walk up to it (NPCs). It's not working out that way though. It will only light up when the player approaches the walls, and I can not figure out why.

    Regarding the sliding Door:

    I'd like to have it so that when these characters approach doors, they will slide open. They are 64 pixels wide, and I'd like them to slide open when characters approach. The thing is I can't think of a simple way to do it. I want it to reverse back on itself around 60 pixels when the characters are a certain distance away. Then, when nobody is close enough, the doors will move back into their original position. I'd like to do this using the sine behaviour, but I can't figure out how. My only options are horizontal and vertical, rather than forward and backward.

    Hope I'm making sense, and I hope somebody can help with either or both of these issues :)

    Link to game

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could add an other for each into your first for each. Something like:

    For each "Walls"

    • set frame to 0
    • for each Bios > do the distance check and set frame to 1 where true

    For the doors you should probably not use the sine behaviour but just move it out of the way when the player (of an enemie) is overlapping it. You could extend the bounding box to have it trigger when someone is close and then move it back to it's origional position when they aren't overlapping.

    edit: here's a capx with the fixxed lighting: dropbox.com/s/g7wfcp8vr61c2g7/SpaceStation.capx

  • Regarding the wall lighting, the real issue is that you're not picking a specific Bios instance when you're testing to see if a Bios is in range of a wall . C2 doesn't know which instance you want to test, so it just picks the first one. Kingpenguin's solution works, but you really only need to check to see if the nearest Bios instance is in range, so I'd suggest picking the nearest Bios to each wall before checking its range.

    Regarding the doors, I agree with kingpenguin that the sine behavior is probably not appropriate. There are a number of ways to have the doors open when an instance is in range. The first way that came to mind is to calculate the open and close coordinates of each door upon the start of layout, save them to instance variables as well as each door's starting coordinates. If an instance is in range, move the door to it's open coordinates. If no instance is in range, move the door to its starting coordinates.

    Here's a capx fixing the lighting and moving doors as I suggested:

    Capx

    I added "every 0.1 second" to make processing a little less intensive.

  • Very clever! Thank you very much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)