Refer to different entry points in the same layout

Get help using Construct 2

Post » Wed Dec 05, 2012 2:14 am

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

https://www.dropbox.com/s/f3hcsl0ay53ba3n/Platform1.capx
B
3
Posts: 4
Reputation: 283

Post » Wed Dec 05, 2012 8:54 am

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
B
13
S
2
Posts: 87
Reputation: 1,244

Post » Wed Dec 05, 2012 3:35 pm

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.
B
3
Posts: 4
Reputation: 283

Post » Wed Dec 05, 2012 6:09 pm

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.Tokinsom2012-12-05 18:11:19
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Wed Dec 05, 2012 6:24 pm

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
B
20
S
8
G
2
Posts: 122
Reputation: 3,202

Post » Wed Dec 05, 2012 7:03 pm

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
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Thu Dec 06, 2012 4:42 pm

[QUOTE=Tokinsom] 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.[/QUOTE]

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...?deadeyes9892012-12-06 16:48:05
B
3
Posts: 4
Reputation: 283

Post » Thu Dec 06, 2012 11:48 pm

[QUOTE=ramones] 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[/QUOTE]

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!!
B
3
Posts: 4
Reputation: 283


Return to How do I....?

Who is online

Users browsing this forum: YoHoho and 11 guests