How do I create an object on another layout?

Get help using Construct 2

Post » Tue Jul 22, 2014 8:17 am

Greetings,

I'm currently on Layout 1, however I would like to create objects on Layout 2, Layer 3.

Is it possible to do so? The Create object command doesn't work as I write the layer there only, obviously the program doesn't get the layers of other layouts so my command does nothing.


Thank you very much
Black Bobby The Hole RPG game Greenlit with 303 votes.
B
38
S
9
G
1
Posts: 173
Reputation: 3,231

Post » Tue Jul 22, 2014 8:55 am

One way to do it would be to use global variables..
Set them to a specific value and on the new layout, if the global variable is that value, create an object..
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 Jul 22, 2014 12:11 pm

I don't want to change layouts until the object has been created. I'm making a loading screen between levels.
Black Bobby The Hole RPG game Greenlit with 303 votes.
B
38
S
9
G
1
Posts: 173
Reputation: 3,231

Post » Tue Jul 22, 2014 12:36 pm

You can't create an object on a layout until the layout has loaded.

You have to do what LittleStain suggested and set a variable to let the layout know it should have that object and then create it in System->On start of layout
Last edited by OddConfection on Tue Jul 22, 2014 1:36 pm, edited 1 time in total.
Find all the Construct 2 games that were on Steam Greenlight here
B
36
S
10
G
7
Posts: 475
Reputation: 7,015

Post » Tue Jul 22, 2014 12:38 pm

I didn't have much faith in this option, to create on a different layout and it definitely decreased now.


Thank you for the answers, I shall make a new layer and make a loading bar there, when the loading bar disappears the layout turns transparent and all the objects can be seen behind.
Black Bobby The Hole RPG game Greenlit with 303 votes.
B
38
S
9
G
1
Posts: 173
Reputation: 3,231

Post » Tue Jul 22, 2014 1:00 pm

It does work, like I said..

Example:
You do not have the required permissions to view the files attached to this post.
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 Jul 22, 2014 2:20 pm

Thank you for the example, however for it to work as I described you would need to put Create object on Event sheet 1, not Event sheet 2 :) so that you really create the object from a different layout.
Black Bobby The Hole RPG game Greenlit with 303 votes.
B
38
S
9
G
1
Posts: 173
Reputation: 3,231

Post » Tue Jul 22, 2014 2:25 pm

why you need to create object on other layout?
just create it on start of the next layout...... no?
B
46
S
16
G
8
Posts: 800
Reputation: 8,347

Post » Tue Jul 22, 2014 2:39 pm

Could you please explain what would be the difference?

Remember that only one layout is active at the same time (only one is visible as well), so any changes made to another layout will have to occur through events..

In my example, on event sheet one you are telling the program where to create the object on layout 2..
on the eventsheet connected to layout 2, you are doing the creation itself, based on what happened in layout 1..
If you'd like it all to happen from the same eventsheet just connect eventsheet one to layout two also and only call the create function if on layout 2 (though I don't see what good that would do you)..
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 Jul 22, 2014 3:15 pm

My project starts with a menu, when the user presses Play it then randomly generates a huge, i mean huge map, 35k x 35k, which then it populates it with objects.

In the menu layer it gets some variables saying how the map will be like, it then should go into a loading layout which creates everything since it freezes on mobiles if you do it on the start of the layout. The loading layout then goes into the said map.

What i was trying to do was to pass the variable from the main menu to the loading layout, the loading layout would create objects on the map layout and would update the loading bar after each object.


So that is why I needed the ability to create objects on one layout from another.



I found a workaround with another opaque layer however as stated above.
Black Bobby The Hole RPG game Greenlit with 303 votes.
B
38
S
9
G
1
Posts: 173
Reputation: 3,231

Next

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests