0 Favourites

Doors That Move the Player

  • Hi, guys. I'm new to construct and I'm having trouble getting my doors to work correctly.

    The Problem:

    I have four doors in a level. All use the same sprite. Door 1 should to door 2 and vice versa, and door 3 should lead to door four, and vice versa. Now, I could just make four separate doors and four separate events, but this strikes me as inefficient. Is there any way to tell each instance of a door apart and ensure they all lead to the correct door?

  • HugeCorporation Inefficient but necessary, and simple. There is no way to set a position to a specific frame. (I think) There is no reason not to make four doors. ;)

  • Hi, guys. I'm new to construct and I'm having trouble getting my doors to work correctly.

    The Problem:

    I have four doors in a level. All use the same sprite. Door 1 should to door 2 and vice versa, and door 3 should lead to door four, and vice versa. Now, I could just make four separate doors and four separate events, but this strikes me as inefficient. Is there any way to tell each instance of a door apart and ensure they all lead to the correct door?

    You'll need to pick the instance of the door via event. You need to have something to tell the doors apart, be it variable, distance from player or whatever condition fits your situation. Check the 'picking' section in the FAQ

    Here is also an example with lots of picking functionality. Only the AI events are by me, everything else is not :)

    So no, you don't need to make multiple events or objects.

  • Actually there is a way...And it's always a good idea to be as efficient as possible...just set each door an instance variable say "door number",to identify it...then create a global variable "choose door" that identifies it

    on collision with door >set global choose door to (door number you want to go to)

    variable door number=choose door >set position to "doorspritename"

    hope that helps

  • Actually there is a way...And it's always a good idea to be as efficient as possible...just set each door an instance variable say "door number",to identify it...then create a global variable "choose door" that identifies it

    >>on collision with door

    >>variable door number=choose door >set position to "doorspritename"

    hope that helps

    Actually you could do that with just

    player on collision with door

    .. open door

    On collision trigger automatically picks the colliding objects so there is no need to pick them again. :)

  • Sorry, edited post. You are looking for a warp type door it seems.

  • vee41...yes but he wants a "warp door"...does he not?...the global is doing the picking...or is it too early in morning?...lol

  • Pixel_perfick You are correct, it is too early and I have to read stuff more carefully. Thanks! :)

  • vee41...ditto,I forgot to add the change global bit...edited...thanks..

  • <img src="http://dl.dropbox.com/u/34375299/Construct%202/examples/4doors.JPG" border="0" />

    I only had to use Is overlapping with trigger once for collision detection .

    "Player On collision with Door" was giving me strange results.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hey, guys. I still haven't got my doors working quite as I want them to, but you seem to have set me on the right path. Thanks for all the help!

  • Actually there is a way...And it's always a good idea to be as efficient as possible...just set each door an instance variable say "door number",to identify it...then create a global variable "choose door" that identifies it

    >>on collision with door >set global choose door to (door number you want to go to)

    >>variable door number=choose door >set position to "doorspritename"

    hope that helps

    pretty much this, only without the global.

    pretty much after you place a variable on the door, change the default value on each doors properties so they are each different.

    Here is an example .capx

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