Add Object to other layouts

For questions about using Classic.

Post » Mon Jan 04, 2010 2:10 pm

Is there a way to push a button on layout1 and have it manipulate (destroy/create) an object on layout2?

I have actually managed to destroy a sprite from one layout on another, but I can't seem to create a new sprite to replace it.
B
2
G
3
Posts: 16
Reputation: 882

Post » Mon Jan 04, 2010 7:28 pm

You could set a global variable on Layout 1 as an indication that such-and-such sprites should be destroyed or created. When Layout 2 is loaded check the variable in Start of Layout and create or destroy them as then needed.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Jan 05, 2010 1:12 am

[quote="deadeye":29vjy76i]You could set a global variable on Layout 1 as an indication that such-and-such sprites should be destroyed or created. When Layout 2 is loaded check the variable in Start of Layout and create or destroy them as then needed.[/quote:29vjy76i]

Thanks, I was hoping I was just missing something simple again.
---
On a related note, is it bad to set up more than one array?
I prefer to use smaller data sources, more localized. Like one array for the player, one for the enemies, and so on, instead of one large array.
B
2
G
3
Posts: 16
Reputation: 882

Post » Tue Jan 05, 2010 1:18 am

[quote="AWT":15bdytx0]On a related note, is it bad to set up more than one array?
I prefer to use smaller data sources, more localized. Like one array for the player, one for the enemies, and so on, instead of one large array.[/quote:15bdytx0]
That should be fine. You might actually end up saving some memory that way.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Tue Jan 05, 2010 3:08 am

[quote="Ashley":3pec96ft]
That should be fine. You might actually end up saving some memory that way.[/quote:3pec96ft]

Thanks, I was hoping that was the case.
B
2
G
3
Posts: 16
Reputation: 882


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests