Refer to different entry points in the same layout

0 favourites
  • 8 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • I have been pulling my hair out trying to figure this out.

    In my game, there are currently 4 layouts. The main Layout is "Layout1"

    I want to be able to go to another layout by contacting the "Door" item. Once through, I want to place "Player" at that doors corresponding "EntryPoint." Or possibly place it at the door itself and have the door object ignore the players presence until he moves away from it (so you don't teleport back and forth infinitely). The "Door" version would be preferred, so I don't have to create an entry point for each door.

    Each door has an associated instance variable that refers to the layout the player will be teleported to. Each entry point also has an instance variable that refers to the layout the player is coming from.

    Teleporting the player to the correct layout based on the doors instance variable is easy. Figured that one out at least <img src="smileys/smiley17.gif" border="0" align="middle" /> . But, placing the player at the correct entry point is killing me. No matter how I try to 'call-up' a particular entry point based on its instance variable, I just can't get it right!

    I need this to be modular like the door, I don't want to have to program the exact coordinate for each entry point for each Layout (and corresponding event sheet).

    dropbox.com/s/f3hcsl0ay53ba3n/Platform1.capx

  • Just been looking at your capx file.

    I know you stated you don't want to have to set the players position for every door, but that may well have to happen depending on how many more of these area's you want to use.

    The second solution could be to destroy the player and create him at the door you want him to return to.

    From Layout 2 -> Layout 1. Destroy Player. Create object player at door (linked to Layout 2)

    I have my own project running in a similar way to yours (moving between layouts like doors to buildings) and I set the position every time. Its a pain but it works.

    I'd be interested in knowing if there is a better way

  • Thank you for the reply. I have spent some more time on the issue, and I still can't find a way to do it.

    Is there a plugin available that helps with this? I imagine something like this would be almost necessary for RPGs and platformers akin to metroid.

  • Give each door a variable called "EntryPoint" or something.

    Find the door in a layout that leads to a door in another layout, and set their EntryPoint variables to the same value, say, 1. This pairs them up. Do this for each "pair" of doors, but make sure each pair has a different value. Now give your player a variable that is set to door.EntryPoint each time he walks through a door.

    +On start of layout

    +Player.EntryPoint = Door.EntryPoint

    -Set Player position to Door

    Then include this ^ in each layout, and you should be set!

    That's how you do this using different layouts, atleast. If you're making a metroidvania or something of the sort I highly suggest using 1 layout and loading rooms through project files or something.

  • spawn the player from the door, and use trigger once (srry it might not work cuz i am a total noob in trigger once and stuff

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One way you could do it instead of using those entrypoint sprites, set the player to the door position and then move him forward a bit so he's not overlapping it.

    layoutDoors.capx

  • Give each door a variable called "EntryPoint" or something.

    Find the door in a layout that leads to a door in another layout, and set their EntryPoint variables to the same value, say, 1. This pairs them up. Do this for each "pair" of doors, but make sure each pair has a different value. Now give your player a variable that is set to door.EntryPoint each time he walks through a door.

    +On start of layout

    +Player.EntryPoint = Door.EntryPoint

    -Set Player position to Door

    Then include this ^ in each layout, and you should be set!

    That's how you do this using different layouts, atleast. If you're making a metroidvania or something of the sort I highly suggest using 1 layout and loading rooms through project files or something.

    I want to make something akin to blaster master. So yes a metroidvania type game basically.

    Can you, or someone else, give a decent explanation as to what you mean? I've spent some time looking into loading rooms through separate project files, but I don't really understand the benefit, or how that fixes the issue with room/layout 'teleportation'

    Also, THANK YOU for the response! I will try that system tonight when I get home and see how it works.

    EDIT: I have been mulling over your idea. Even with the correct entrypoint variable loaded, setting the player position to the door wont necessarily grab the correct door if more than one instance exist in the current layout. Or am I misunderstanding your idea...?

  • One way you could do it instead of using those entrypoint sprites, set the player to the door position and then move him forward a bit so he's not overlapping it.

    https://dl.dropbox.com/u/8367729/construct/example/layoutDoors.capx

    THANK YOU SO MUCH. I would hug you right now if I could. The door rotation idea is bloody brilliant! Finally a way to pop the character out on the proper side without strange variable nonsense.

    Also, I don't quite understand how the game knows which door to pick. I see "Door: TeleportLocation = PreviousLayout" and I realize what that is comparing, but at one point in time I had a setup that I swear was an exact copy of that line, with very similar actions, yet it didn't work. SO I deleted it. Along with many other failed attempts.

    THANK YOU!!

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