What to do with "unused objects at start" on the layout?

Get help using Construct 2

Post » Tue Feb 21, 2017 10:02 am

Hello,

I've seen that it is common practice to place objects which will be used later (aka "they will be spawned dynamically") outside the Layout.

This is somewhat weird to me... Objects with bullet behaviour are flying off screen as soon as the layout starts etc, so you have to place them at the "correct" border of the layout so they not come into the players view during the start while they're flying off.. or place them on a "scrap layout" altogether.

Is this really the "normal" way of handling the "unused" objects? Or is there a better one?
B
16
S
6
Posts: 26
Reputation: 1,221

Post » Tue Feb 21, 2017 10:15 am

Destroy them on start of layout then create them when you need them. If they are outside the layout but then destroyed then they are loaded in memory and any lag is avoided.
B
46
S
16
G
78
Posts: 2,168
Reputation: 46,353

Post » Tue Feb 21, 2017 10:36 am

plinkie wrote:Destroy them on start of layout then create them when you need them. If they are outside the layout but then destroyed then they are loaded in memory and any lag is avoided.


Okay, that will work.. quite a "brutal" method and somehow rough around the edges, I would have guessed that Construct has a method to handle objects which are needed later on in the game a more elegant way, but doesn't seem so.

Thanks for your help! :)
B
16
S
6
Posts: 26
Reputation: 1,221

Post » Tue Feb 21, 2017 11:00 am

UncleHo74 wrote:
plinkie wrote:Destroy them on start of layout then create them when you need them. If they are outside the layout but then destroyed then they are loaded in memory and any lag is avoided.


Okay, that will work.. quite a "brutal" method and somehow rough around the edges, I would have guessed that Construct has a method to handle objects which are needed later on in the game a more elegant way, but doesn't seem so.

Thanks for your help! :)


you can destroy them or use their settings to set them disabled.

If it is a bullet I destroy it and create when needed. For buttons and other objects I use disabled and enable as needed. I set all my buttons on the layout and make them visible and enabled as needed.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Tue Feb 21, 2017 12:16 pm

lamar wrote:
you can destroy them or use their settings to set them disabled.

If it is a bullet I destroy it and create when needed. For buttons and other objects I use disabled and enable as needed. I set all my buttons on the layout and make them visible and enabled as needed.


Yeah, I know that there are some objects which can be disabled via the settings.. I do that already, my problem was specific to bullets, particles etc. which have to exist at the start but can't be disabled fully (well, you could like setting the speed to zero etc. etc. but it's not THE solution for me either).
B
16
S
6
Posts: 26
Reputation: 1,221

Post » Tue Feb 21, 2017 2:04 pm

Use a "assets" layout that you never go to on runtime to only place all your objects. That's what we usually do on our projects and it works and keep your game layouts clean.
Lead developer at Octeto Studios
Visit our portfolio at: http://www.octetostudios.com/ :)
Facebook || Twitter || Youtube
B
37
S
7
G
5
Posts: 217
Reputation: 5,614

Post » Tue Feb 21, 2017 2:33 pm

GamerGon wrote:Use a "assets" layout that you never go to on runtime to only place all your objects. That's what we usually do on our projects and it works and keep your game layouts clean.


Yeah, as I said in my first post, I usually already do this, my "scrap layout".. :)

Still not elegant in my eyes, and occasionally I started this scrap layout when I click the "Run Layout" Button... :P
B
16
S
6
Posts: 26
Reputation: 1,221

Post » Tue Feb 21, 2017 2:51 pm

UncleHo74 wrote:
GamerGon wrote:Use a "assets" layout that you never go to on runtime to only place all your objects. That's what we usually do on our projects and it works and keep your game layouts clean.


Yeah, as I said in my first post, I usually already do this, my "scrap layout".. :)

Still not elegant in my eyes, and occasionally I started this scrap layout when I click the "Run Layout" Button... :P


It's a good practice though :)
Lead developer at Octeto Studios
Visit our portfolio at: http://www.octetostudios.com/ :)
Facebook || Twitter || Youtube
B
37
S
7
G
5
Posts: 217
Reputation: 5,614

Post » Tue Feb 21, 2017 4:32 pm

GamerGon wrote:It's a good practice though :)


Who am I to ignore good practice? ;) I'll keep this in mind, thanks!
B
16
S
6
Posts: 26
Reputation: 1,221

Post » Tue Feb 21, 2017 4:55 pm

It makes it easier at least for me to keep objects I may want to copy or clone as I progress on the game on the original layout as dragging them from the sprite list resets sizes. After your game is done you can clean it up and use a separate layout but I don't want two layouts with the same sprites while designing because the settings may not get changed in both sprites. JMO.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 38 guests