How do I create working doors?

0 favourites
  • 8 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • So I've been able to create doors that can send someone to another layout. Sending them back (through the "same" door) is proving to be an issue for no apparent reason.

    https://www.dropbox.com/s/ddin54gbu8uhy ... .capx?dl=0

    I've got the second door transfer event disabled so you can make it to the second layout by pressing up on a gamepad. However, if I undo the disable, the character simply uses the first door and gets auto-teleported back to the start of the first layout. If I add a wait to the tele, the char can run around in layout two before he's auto-tele'd back. Any ideas?

    I've looked up some older posts, but none of the caps seem to be live links anymore and most of the issues don't revolve around having issues with the doors and more about globals...

    Thank you for any help in advance.

  • Hello, I have not looked at your .capx yet. I will later when I have time.

    I use on event collision with door create object at location on next layout. and use variables is open/close to check if door is open or closed. I also had to add presist to open object so it remembers if it was visible or invisible when player returns to the layout and also if the same door on layout 2 is open or closed when the other door is opened.

  • I use on event collision with door create object at location on next layout. and use variables is open/close to check if door is open or closed. I also had to add presist to open object so it remembers if it was visible or invisible when player returns to the layout and also if the same door on layout 2 is open or closed when the other door is opened.

    That sounds similar to what I've tried to implement, however, I'm not sure what you mean by closing the door. I figured that once you went through and had the door spawn your char that that was that essentially.

    Also, what's a "presist"?

  • presist is a behavior you add to objects to keep them active even when off screen and so they remember their state.

    as for my doors I made a Maniac Mansion clone where doors open and close, lock and unlock and open when some one passes through the door at another location.

  • Sounds cool. Well, when/if you get a chance to take a look at my capx and take a look at my doors and figure out why they don't work, that'd be awesome.

    I'm very new to this and am still picking up tricks here and there. If anyone else is reading this, I'd love to hear some theories.

  • Edit 2: Here is your .capx with my mods. https://www.dropbox.com/s/chqv50gbic7ry ... .capx?dl=0

    here is the issue i see. door transfer = 1

    but the code says door transfer=0 and door transfer=2 you never set it to one.

    you do not need that code in your game as you are using.

    player is over lapping door and on gamepad down goto level.

    you might how ever want to add is overlapping imagepoint so player has to be in the middle of the door.

    that will make it work without all the extra code you have added.

    as for my doors they are more advanced as you have to interact with them

    open = can enter room/level

    closed = do nothing when overlapping

    locked = do tasks before you can open door

    unlocked = lock before doing event.

    on level remember door states (opened, closed, locked and unlocked)

    on enter level set door state compared to door on other level

  • I hear what your saying. I believe that I wouldn't need the "doortransfer" bit if I was only using one door per room. However, some rooms will have three to four doors so I need a way to tell them game which door to spawn the character properly on.

    As far as never setting it to 1, I do all of those transitions in the Door Transfer event page. I didn't think I needed them all in one place, but it helped me feel a bit more organized.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • with that said object name = door1, door2, and so on. create object at door1 image point on layout

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