How do I move player from one layout to another?

Forum Home Forum Home > Construct 2 General > Construct 2 general
 Post Reply Post Reply Page  12>
Author
980 Rep
Post Options Post Options   Quote MarshIsland Quote  Post ReplyReply Direct Link To This Post Topic: How do I move player from one layout to another?
    Posted: 14 Apr 2012 at 2:04am
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. :)
Back to Top
7,746 Rep
Post Options Post Options   Quote Wink Quote  Post ReplyReply Direct Link To This Post Posted: 14 Apr 2012 at 2:19am
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)
Back to Top
6,763 Rep
Post Options Post Options   Quote kittiewan Quote  Post ReplyReply Direct Link To This Post Posted: 14 Apr 2012 at 2:59am
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.



Edited by kittiewan - 14 Apr 2012 at 3:02am
Back to Top
980 Rep
Post Options Post Options   Quote MarshIsland Quote  Post ReplyReply Direct Link To This Post Posted: 14 Apr 2012 at 3:28am
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. :)
Back to Top
7,746 Rep
Post Options Post Options   Quote Wink Quote  Post ReplyReply Direct Link To This Post Posted: 14 Apr 2012 at 3:42am
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.

Edited by Wink - 14 Apr 2012 at 3:52am
Back to Top
3,684 Rep
Post Options Post Options   Quote C-7 Quote  Post ReplyReply Direct Link To This Post Posted: 14 Apr 2012 at 3:47am
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.
Back to Top
3,012 Rep
Post Options Post Options   Quote aridale Quote  Post ReplyReply Direct Link To This Post Posted: 14 Apr 2012 at 8:08pm
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
Back to Top
6,322 Rep
Post Options Post Options   Quote Haematite Quote  Post ReplyReply Direct Link To This Post Posted: 14 Apr 2012 at 9:21pm
There only has to be at least one instance of each object in the entire game, not in each layout =)
Back to Top
6,763 Rep
Post Options Post Options   Quote kittiewan Quote  Post ReplyReply Direct Link To This Post Posted: 14 Apr 2012 at 10:29pm
Originally posted by MarshIsland MarshIsland wrote:

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


System overlapping portal? Do you mean player?
Back to Top
523 Rep
Post Options Post Options   Quote Syk0 Quote  Post ReplyReply Direct Link To This Post Posted: 15 Apr 2012 at 1:33am
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
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down