Deleting a sprite without completely removing it?

This forum is currently in read-only mode.
From the Asset Store
In this template the music plays without looping in your game
  • I realize this must be the dumbest question on this entire forum but I just can't find the solution.

    I have a sprite in my layout that's only supposed to be created at runtime. If I delete the sprite it gets removed entirely from my application. I just don't want it on my screen at start-up. How do I get rid of it?

    Cheers

  • I realize this must be the dumbest question on this entire forum but I just can't find the solution.

    I have a sprite in my layout that's only supposed to be created at runtime. If I delete the sprite it gets removed entirely from my application. I just don't want it on my screen at start-up. How do I get rid of it?

    Cheers

    That's the pain, but you have to keep it on outside the layout, and deactivate it on the layout start in the events sheet.

    However i would prefere to to have global objects that you don't have to keep on layout.

  • Tick the 'destroy at startup attribute'.

  • That's the pain, but you have to keep it on outside the layout, and deactivate it on the layout start in the events sheet.

    No!

    Tick the 'destroy at startup attribute'.

    Yes!

  • Tick the 'destroy at startup attribute'.

    Ah, didn't notice that one. A working solution I suppose, though I'd really prefer being able to remove it from the layout.

  • If you want it in your game, it has to exist somewhere. The layout is pretty much the only place it can exist... so what do you suggest?

  • You can tick the eye thing of the layer to make the layer hide from view, thus hiding everything on the layer so you can work on stuff below.

  • Why would you want to remove it? What if you then need to edit it or its properties?

  • If you want it in your game, it has to exist somewhere. The layout is pretty much the only place it can exist... so what do you suggest?

    You know how things exist in the layout without being on screen, like the Mouse & Keyboard object? Something like that. If the object is created (or spawned) somewhere in the event list it shouldn't have to be in the layout, but perhaps it's just a matter of habit.

    Why would you want to remove it? What if you then need to edit it or its properties?

    It's just that I like things clean and don't want anything on the layout other than the things I want there at the start of the frame. I understand it's not a REAL issue since the object will never be visible in the game. It's just something stuck in me, like how you structure your code in regular languages.

    Editing the properties of an object not in the layout should be possible (EDIT: is already possible) via the objects-list to the left of the layout screen.

  • If you are really concerned about keeping a layout as clean as possible, I'd take the advice above and make a layer which is hidden to put it all on, or place it as far offscreen as you can.

  • This is what I do. I take all my objects and put it on one layer. Then in the event layout, I have an event that destroys them if they are outside the layout. It's better to do that anyway. if you have all objects out the layout, you can delete things without worrying about deleting something important.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You shouldn't have to use events, just use the attribute, it'll avoid clutter with lots of these objects (such as in a level editor).

  • You can also move it off screen, set its opacity to 0 and then lock it so you can't click on it. At that point, it will seem like it's not there. But then you would need to set its opacity manually every time you create one or it would be invisible when you create them.

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