retain objects for included event sheets.

Get help using Construct 2

Post » Mon Dec 30, 2013 11:53 pm

Hi guys. I have a few sprites representing different animation and states of my character and wish to somehow automatically add them as objects to a new layout. I already have the player movement logic included in a seperate events sheet. How can I do this for sprite objects I have created for my character too?

Thanks :). tsugaruddr2013-12-30 23:54:55
B
3
Posts: 36
Reputation: 299

Post » Tue Dec 31, 2013 3:12 pm

If I remember correctly Construct 2 has this feature from Construct Classic: You could put them on the first layout and set them to "global" objects, then they will automatically appear on every layout afterward unless you destroy them.

Or you can create them from an event sheet included at the start of your layouts
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
116
S
41
G
17
Posts: 2,201
Reputation: 19,539

Post » Sun Jan 05, 2014 12:07 am

This doesnt work for construct 2. Any ideas?

The documentation says:

Global
By default, all instances are destroyed when the layout ends (e.g. when going to the next layout). If Global is Yes, none of the instances of this object type will be destroyed when switching layouts.
B
3
Posts: 36
Reputation: 299

Post » Sun Jan 05, 2014 12:19 am

By default, all instances have Global set to Off - that is why they are destroyed between layouts as described in the manual. If you select Global to Yes in the Properties bar then you will achieve the effect you are looking for.

I personally prefer to store all object properties in an array or variables as I find it easier to manage - because I then know exactly what characteristics are passed to the sprite each time the layout starts (enables a re-start or re-try option, for example).
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,205
Reputation: 43,832

Post » Sun Jan 05, 2014 12:22 am

THis is my problem though... The items are all set as Global to Yes in Object type properties in the Properties bar. So what have I not done?
B
3
Posts: 36
Reputation: 299

Post » Sun Jan 05, 2014 12:50 am

Mmmmm - I must confess that I've had limited success with Global and have 'progressed' to creating the common game elements at the start of each layout. Are you able to share a capx so we can take a look? I'm sure that someone will be able to figure out why it's not working for you.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,205
Reputation: 43,832

Post » Sun Jan 05, 2014 1:22 am

I am not sure how you have your event sheets set up. Have you tried creating a System event - On start of layout and then a system action Create Object?
B
12
S
4
G
1
Posts: 11
Reputation: 900

Post » Sun Jan 05, 2014 2:10 am

Are you sure that in the second layout you are including the correct events ?

Post your capx if you want us to be more precise in our helping.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,287


Return to How do I....?

Who is online

Users browsing this forum: nahima and 10 guests