How do I move player from one layout to another?

Discussion and feedback on Construct 2

Post » Sat Apr 14, 2012 2:04 am

I'm currently making a platform game in construct2, and I can't figure out how I'll move my character from the end of my level (layout1) to level2 (layout).

I started using construct2 today, so I'm not experienced, any answers and solutions will be of great suppert. :)
B
9
S
1
G
3
Posts: 13
Reputation: 2,510

Post » Sat Apr 14, 2012 2:19 am

Just make an object at the end of your layout like a door or something. Then in your event sheet for that level do something like this:

+Player: Is overlapping (The object you made)
    -System: Go to layout (The next layout you want to go to)
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Sat Apr 14, 2012 2:59 am

What Wink said, but you also need to consider the actual player sprite object and how it gets to the new layer.

Select the player sprite and look at the properties panel. In the first group you'll see a "Global" parameter. If this is "No", which is the default, then 2 things happen:

a) The player object won't appear on the new layout unless you place it there, either at design time or by creating or spawning it.
b) The instance variables for that player object are reset to the defaults in the new layout.

However, if you have global set to Yes, then:
a) The player object automatically appears on the new layout in the same position it was in in the old layout (but you can reposition it, of course.)
b) The instance variables that changed in the previous layer retain their values in the new layout.

kittiewan2012-04-14 03:02:53
B
29
S
11
G
12
Posts: 281
Reputation: 11,888

Post » Sat Apr 14, 2012 3:28 am

I am completely sure that I did everything right, but it still does not work... I have "System - Overlapping object: Portal Action Go to layout2. The player is also Global.

I appreciate your replies. :)
B
9
S
1
G
3
Posts: 13
Reputation: 2,510

Post » Sat Apr 14, 2012 3:42 am

Did you place your player on layout 2's level? I usually just drag him out of the Projects/Object Types window folder onto the level I want him on.Wink2012-04-14 03:52:29
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Sat Apr 14, 2012 3:47 am

I wouldn't even bother making the player global. Just copy and paste the player into the layout you want just as you have it in the first layout but in the position you want it to start. Be sure to include the events for movement and such that you might have on layout 1 so everything's works. Also, consider making an event sheets with all of the player info that you can just right-click and include on every layout to keep you from redoing too many events.

You can also have an invisible object where you want the player to start and on start of layout, create player at said object's position. You can then also use that object's position for respawning on death, too. In any case, the player sprite must get placed in the layout somehow and you should include necessary events for things to work.
B
90
S
32
G
14
Posts: 935
Reputation: 14,540

Post » Sat Apr 14, 2012 8:08 pm

isnt there stil an issue with creating objects thru events that dont already exist in the layout?

So if your objects arent global your still gonna have to place them somewhere in each layout before you can create them with events
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Sat Apr 14, 2012 9:21 pm

There only has to be at least one instance of each object in the entire game, not in each layout =)
B
22
S
6
G
10
Posts: 118
Reputation: 8,005

Post » Sat Apr 14, 2012 10:29 pm

[QUOTE=MarshIsland] I am completely sure that I did everything right, but it still does not work... I have "System - Overlapping object: Portal Action Go to layout2. The player is also Global.

I appreciate your replies. :)[/QUOTE]

System overlapping portal? Do you mean player?
B
29
S
11
G
12
Posts: 281
Reputation: 11,888

Post » Sun Apr 15, 2012 1:33 am

i used a sprite to redirect on the one i am making, i have a trapdoor that opens when the last monster is killed, then the trapdoors opens as a another sprite, then the collision sends me to another layout
B
5
S
1
Posts: 13
Reputation: 704

Next

Return to Construct 2 General

Who is online

Users browsing this forum: saiyadjin and 10 guests