Sprites and where to keep them?

Get help using Construct 2

Post » Mon Jul 04, 2016 8:22 am

A long while back it was said to keep the sprites just outside of the layout. Now i've seen some say keep them on a standalone layout.

What is "best practice" today for the sprites?
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Mon Jul 04, 2016 9:31 am

When one tells you to keep them on a standalone layout, there was probaly a context. And this context is 'global'. Yes, it is very handy to keep all global objects on a standalone layout, AND on the same layer. This way, when you change layout, they are just there. Very handy for HUD's, for example.

In other cases, i prefer to place em just outside and then destroy them in the layout start up. Create when needed. But this is just what i prefer.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Jul 04, 2016 10:05 am

Either method works fine... a separate "global" layout, or just outside the layout bounds (then destroy on startup).

There's no real benefit to using either method, apart from calming any OCD tendencies you may have.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Mon Jul 04, 2016 3:33 pm

Thank you for the input.


SoldjahBoy wrote: calming any OCD tendencies you may have.
~Sol


Exactly!
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Tue Jul 05, 2016 9:26 am

SoldjahBoy wrote:Either method works fine... a separate "global" layout, or just outside the layout bounds (then destroy on startup).

There's no real benefit to using either method, apart from calming any OCD tendencies you may have.

~Sol


Actually I never thought of creating a layout with ALL objects. Cool solution, and saves event/actions of destroying on starup...
B
18
S
7
G
1
Posts: 157
Reputation: 1,928

Post » Tue Jul 05, 2016 9:32 am

trueicecold wrote:
SoldjahBoy wrote:Either method works fine... a separate "global" layout, or just outside the layout bounds (then destroy on startup).

There's no real benefit to using either method, apart from calming any OCD tendencies you may have.

~Sol


Actually I never thought of creating a layout with ALL objects. Cool solution, and saves event/actions of destroying on starup...


Please note the layout must be set as GLOBAL in it's properties, or else it may not work the way you expect it to.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Tue Jul 05, 2016 10:41 am

SoldjahBoy wrote:
trueicecold wrote:
SoldjahBoy wrote:Either method works fine... a separate "global" layout, or just outside the layout bounds (then destroy on startup).

There's no real benefit to using either method, apart from calming any OCD tendencies you may have.

~Sol


Actually I never thought of creating a layout with ALL objects. Cool solution, and saves event/actions of destroying on starup...


Please note the layout must be set as GLOBAL in it's properties, or else it may not work the way you expect it to.

~Sol


Ah, thanks for the heads up :)

Also, I imagine there's a performance issue keeping all those sprites alive rather than in a specific layout, in case we're talking about LOTS of sprites...
B
18
S
7
G
1
Posts: 157
Reputation: 1,928

Post » Tue Jul 05, 2016 3:23 pm

99Instances2Go wrote:i prefer to place em just outside and then destroy them in the layout start up. Create when needed.


This had never occurred to me before. I think i'll play with this when I get home. I have a lot of sprites on certain layouts, and I take it destroying them on Start of Layout and only recreating them when I need to saves processing?
In development: Avalon Isle
B
12
S
4
G
1
Posts: 44
Reputation: 1,496

Post » Tue Jul 05, 2016 3:35 pm

Grymligast wrote:
99Instances2Go wrote:i prefer to place em just outside and then destroy them in the layout start up. Create when needed.


This had never occurred to me before. I think i'll play with this when I get home. I have a lot of sprites on certain layouts, and I take it destroying them on Start of Layout and only recreating them when I need to saves processing?


Yes it sure does.

Destroying on startup can be problematic in some situations though - like if you're loading data for objects.

I destroy things on startup as well, but often use an instance variable to declare "unused" objects before destroying them.

I have something like;

[ON STARTUP]
--[Object.InstanceVariable=0] Destroy Object

This way, I can set that variable to 1 or whatever for loaded items, and the default value (0) gets destroyed.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474


Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], Kin, ratboy3, tinhofiel, totoe and 40 guests