Object creation at runtime, best approach

0 favourites
  • 8 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hey,

    I'm adding explosions and gnarly effects in my game, but, being someone just starting in Construct, I just found out that there's a need to have an instance of an object present in the game world in order to create/spawn it in other places, like in the tutorial (the bullet part).

    Now, I can accept this no problem with recurring items, whether enemies, bullets or pickups, because they are used fairly often. But for an object that is spawned/created when the player dies (an explosion, in this case) we can get to the point where we get objects in memory that we can never use. EVER!

    I assume there's no way around this, yes? So, in my mind I see that the best approach is to add these one-off items in a back-behind-the -background layer so they are not seen (I *hate* having stuff outside the layout, seems clumsy and sloppy).

    Thoughts?

  • you can use a separate layout..

    I made one just called "all objects" it has no event sheet, just every object placed in a grid.

    You can use it to set the default values for all objects upon creation, also you don't have to worry about destroying loads of things on start up.

  • Hum that's interesting... so you're suggesting that we shouldn't have to have an instance of every object on the layout for it to exist. I agree with you, as we have the "Objects" bar with all the objects there, so why do we need it on the layout also?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 7soul, in the error message that pops up it says it will be fixed in a future build.

  • you can use a separate layout..

    I made one just called "all objects" it has no event sheet, just every object placed in a grid.

    You can use it to set the default values for all objects upon creation, also you don't have to worry about destroying loads of things on start up.

    I am using a separate layer, one at 0, with all the items that are not permanent/discardable.

    Hum that's interesting... so you're suggesting that we shouldn't have to have an instance of every object on the layout for it to exist. I agree with you, as we have the "Objects" bar with all the objects there, so why do we need it on the layout also?

    Nah, I'm not suggesting anything. I'm looking for ways to improve this mechanic, but I don't really think there is any, though strangely, all items, present in a layer or not, appear on the event list. So I assume we can get them somehow even if they are not hidden in a frame?

  • I always just use the outside-layout trick. I guess it does look kinda sloppy, but then again, so is everything else in my life. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Now that there's families, you can put all your fx sprites and stuff like that in a family and do

    System: On start of layout
    [ul]
    	[li]> fxFamily: Destroy
  • Hm... Guess I'll have to read about that, then.

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