0 Favourites

Sprites and where to keep them?

  • 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?

  • 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.

  • 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

  • Thank you for the input.

    calming any OCD tendencies you may have.

    ~Sol

    Exactly!

  • 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...

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • > 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

  • >

    > > 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...

  • 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?

  • > 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)