Doors?

Get help using Construct 2

Post » Tue Dec 03, 2013 5:18 pm

I am trying to figure out the basics for doors. I am working on a platform game with several doors leading to other layouts (stages, houses, caves etc.).

Current set up:
event: door, is overlapping, player, keyboard, A is down,
action: system, go to (desired layout)

The problem i am running into is the specific location. sometimes I need the character to go to various locations in the stage. I've tried the "set position to" and listed specific coordinates with no success.

What combinations am I missing?
I haven't found any tutorials on this - am I overlooking?
It seems like this would be a very common feature that I am totally overlooking; like a "door function/action". Maybe it goes by another name other than doors?

Any wisdom is greatly appreciated!
B
4
S
2
Posts: 3
Reputation: 483

Post » Tue Dec 03, 2013 6:30 pm

Would it work for you to create a global variable and set it with the door variable and use that to set player position in the next layout?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 03, 2013 7:42 pm

I agree with LittleStain. You should have two variables (pos X & pos Y) and change them accordingly.
Thiago Rocha
[email protected]
B
17
S
4
G
5
Posts: 41
Reputation: 4,269

Post » Tue Dec 03, 2013 10:09 pm

In the door object create two instance variables as said above one for the new x and the new y location you want to jump to. Then when your person contacts the door access the variables to set the x and y of your player. This way will allow you to have unique locations for every door. As I was learning CS2 basics I used this technique in my project itworked well. My doors are invisible objects all the same. Using an invisible object as your jump to location trigger allows you to have many other visible objects . Like multiple style doors colors and shaper per say. yet keep the code to a minimum because the game is looking to trigger with the invisible object.
B
28
S
5
G
2
Posts: 77
Reputation: 3,087

Post » Tue Dec 03, 2013 10:17 pm

@Justin
I also had two more instance variables in the trigger object to change the current view. Assuming since you want to move your player to a specific location there is a good chance the view will not be set to follow the player. this way the view will always center on the room in focus but player may appear at any location within that room. such as door on left or right or maybe a door in the center. if you use doors in the middle of a room you may not want the trigger to be collision alone but on collision also check for a specific key press to use the door.
B
28
S
5
G
2
Posts: 77
Reputation: 3,087

Post » Tue Dec 03, 2013 11:20 pm

@Justin

Here is a demo of my way.

Instructions use left right arrow to move player press space to use door.

https://dl.dropboxusercontent.com/u/223672920/Door%20Example.capxPennington Games2013-12-03 23:22:06
B
28
S
5
G
2
Posts: 77
Reputation: 3,087

Post » Wed Dec 04, 2013 3:25 am

Thanks all for the information. Pennington, you're awesome!
B
4
S
2
Posts: 3
Reputation: 483

Post » Wed Dec 04, 2013 3:54 pm

You're Welcome @Justin Good luck with the rest of your project. I like to give back since this community has given to all of us so much.
B
28
S
5
G
2
Posts: 77
Reputation: 3,087


Return to How do I....?

Who is online

Users browsing this forum: Christmas, dop2000, Hyune and 15 guests