A Better Door System [SOLVED]

Get help using Construct 2

Post » Thu Apr 25, 2013 11:08 am

Hi all I've just prototyped a 'door' mechanic which is trying to emulate the way traditional 2D games like Cave Story work.

https://dl.dropboxusercontent.com/u/3317708/DoorsPrototype/index.html

Here's the Capx https://dl.dropboxusercontent.com/u/3317708/Doors.capx

My objective is to have the player spawn in the new layout from the door they just used.

If you see in my Capx my method uses quite a lot of events, I'm wondering if anyone can think of a more efficient / streamlined approach to creating this system? I can imagine that as my project gets bigger, it's going to be a hell of pain to keep track of all these doors in the way I'm currently doing it. Any info on this would be appreciated.

Best,
MikCrudeMik2013-04-25 13:55:57
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Thu Apr 25, 2013 11:15 am

Try something like this:

Give door object instance variable: gotoLayout
For each door, put the name of the layout you want the door to lead into this variable.

On spacebar pressed
Player is overlapping door
.. goto layout door.gotoLayout
.. // perhaps set your 'locationPoint' here too, so you know where to spawn the player in the new layout
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Thu Apr 25, 2013 11:36 am

Ah that sounds good I'll try it out and report back!
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Thu Apr 25, 2013 12:58 pm

@vee41 Hmmm I totally understand how to use the variables to tell the game what layout to go to but I'm struggling to figure out how to get the player to spawn in the correct location. I've updated the original capx with where I am at at the moment.

Thanks
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Thu Apr 25, 2013 1:15 pm

This should work:

Door system

What I changed is, that it saves the name of the layout when entering a door, and at the next layout, spawns the player at the door that leads to previous layout.vee412013-04-25 13:39:01
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Thu Apr 25, 2013 1:32 pm

great that makes sense but I'm getting errors from dropbox downloading your file :(
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Thu Apr 25, 2013 1:39 pm

@CrudeMik Fixed it.
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Thu Apr 25, 2013 1:55 pm

Perfect, thanks a bunch
B
39
S
12
G
8
Posts: 580
Reputation: 7,108


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 0 guests