How do I move player from one layout to another? Forum Home > Construct 2 General > Construct 2 general |
Post Reply
|
Page 12> |
| Author | |
Post Options
Quote Reply
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. :) |
|
![]() |
|
Post Options
Quote Reply
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) |
|
![]() |
|
Post Options
Quote Reply
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 |
|
![]() |
|
Post Options
Quote Reply
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. :) |
|
![]() |
|
Post Options
Quote Reply
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 |
|
![]() |
|
Post Options
Quote Reply
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. |
|
![]() |
|
Post Options
Quote Reply
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 |
|
![]() |
|
Post Options
Quote Reply
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 =)
|
|
![]() |
|
Post Options
Quote Reply
Posted: 14 Apr 2012 at 10:29pm |
|
System overlapping portal? Do you mean player? |
|
![]() |
|
Post Options
Quote Reply
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
|
|
![]() |
|
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |