why do objects have to be on layout

Discussion and feedback on Construct 2

Post » Wed Mar 19, 2014 8:12 am

I use createobject to change the appearance on the screen based on certain conditions(display buttons etc.) but the object must be present in the layout, making it quite cluttered as i have a lot of objects.
why is it that the object must be present in layout?
B
9
S
2
Posts: 76
Reputation: 709

Post » Wed Mar 19, 2014 8:27 am

Well they need to be on the layout at some point or you wouldnt see them. The other option is to create the objects at the start of the layout and place them where they need to be using code.
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Wed Mar 19, 2014 8:47 am

@kaiko

You might try to put sprites on an unused layout.
B
108
S
26
G
272
Posts: 4,471
Reputation: 152,277

Post » Wed Mar 19, 2014 8:51 am

Bear in mind that the objects don't need to be present on the layout on which you intend to create them. They just need to be somewhere. I guess the thinking is that objects aren't assigned their basic properties like opacity, size, etc. until they've been placed. Not sure why that is, exactly - I'd think that an object could be just as easily parked in the project folder with default properties, but whatevs, that's just how it works.

Personally, I like to create a parking lot layout in which I store all my objects that are waiting to be created. The only time I'll have an object on standby in the actual game layout is if it's a large image or one with a lot of animations/frames, which would cause a slight lag as its created if that would've been the first time it is to appear on the layout.
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Wed Mar 19, 2014 12:04 pm

spongehammer wrote:The other option is to create the objects at the start of the layout and place them where they need to be using code.


this is what i want to do but construct gives an error message if object isn't present in layout.
B
9
S
2
Posts: 76
Reputation: 709

Post » Wed Mar 19, 2014 12:31 pm

kaiko wrote:
spongehammer wrote:The other option is to create the objects at the start of the layout and place them where they need to be using code.


this is what i want to do but construct gives an error message if object isn't present in layout.


Correct. They have to be on some layout to be included with the game information/export. Just have a dummy layout and throw all your objects on there to meet that requirement.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Wed Mar 19, 2014 3:16 pm

Holy moly! I've always wondered this and now it makes complete sense to just create a dummy layout for just the objects/images. This is one of those "this changes everything" moments for me.
B
7
S
1
G
1
Posts: 56
Reputation: 732

Post » Wed Mar 19, 2014 3:28 pm

Agreed punkineo - this helps me wrap my head around layouts versus layers.
I see it says in the manual you can have as many layouts /scenes as you want but using a layout as a storage dump for objects is really cool.
B
8
S
1
Posts: 3
Reputation: 412

Post » Wed Mar 19, 2014 10:02 pm

I always have a layout in each game called "Sandbox" that I throw one copy of all objects into. This makes it so much cleaner not to have to have objects off screen on all my other layouts prior to creating the instances of them in events.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Wed Mar 19, 2014 11:25 pm

The dummy layout thing is a very good idea.

But is there a way to modify the z-order if you place all sprites on a dummy layout instead of the correct one?
Free Android game: https://play.google.com/store/apps/deta ... VSMrMonkey

"Seven Birds VS Mr. Monkey" is a simple yet fun game.

Mr. Monkey is being attacked by birds and without a way to escape all hope seems lost. But if you think Mr. Monkey goes down that easily you are mistaken!

Help Mr. Monkey to upgrade his skills, get special attacks and show these birds who's the boss!
B
9
S
1
G
1
Posts: 51
Reputation: 755

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 27 guests