Same sprite in multiple layouts

For questions about using Classic.

Post » Tue Dec 07, 2010 3:59 am

I can't seem to figure out how to do this, without copying and pasting for each layout i make. Help!
B
1
G
2
Posts: 3
Reputation: 631

Post » Tue Dec 07, 2010 6:27 am

try make it global.
properties-common->global
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Tue Dec 07, 2010 7:35 am

If you make the sprite global, it is accessible from any layout AFTER the one the sprite is on loads. But in editor the sprite won't be available, only through event sheet. Also, the sprite keeps any data between layout changes - for example if it has been moved, it will be there when you go to new layout.

So, with global sprites, keep this in mind:
- reset their variables and/or position/size/etc as needed on layout change (or just delete it if you don't need it, then recreate)
- it is a good idea to make a sprite global, then have it destroyed on start of layout, then wherever you need the sprite, just create it, then when it is not needed anymore, destroy it - unless you want to keep the sprite data

So, in short, when the sprite is made global, it is available everywhere through code and it keeps any data.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue Dec 07, 2010 4:41 pm

Cool thanks!
B
1
G
2
Posts: 3
Reputation: 631


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests