How do I add Sprites to a Container dynamically?

0 favourites
  • 13 posts
From the Asset Store
Add SubRip (SRT) subtitles to your videos in Construct 3
  • Is this possible? I have been unable to find any posts or pages on it or any actions in Construct.

    I am happy either adding sprites or sprite instances to a container.

  • You mean at runtime? I don't think you can do this.

    If you just want certain objects to be created when another object is created, you can accomplish that with an 'on created' condition.

    However, if you want to take advantage of the picking capabilities of containers (their most useful feature IMO), you'll have to figure out another approach.

  • Well... mostly I want the uniform motion, which I can do mechanically, but I was hoping I could just add them to containers dynamically.

  • Well... mostly I want the uniform motion, which I can do mechanically, but I was hoping I could just add them to containers dynamically.

    I think you are skipping some steps on us here. Can you explain what you are trying to do in a little more depth?

  • Make a scrollable table object that I can dynamically load sprites/text into. The "Container" behavior would allow me to move only one object in the container to scroll the entire table up and down.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are you sure about that?

  • Make a scrollable table object that I can dynamically load sprites/text into. The "Container" behavior would allow me to move only one object in the container to scroll the entire table up and down.

    A Container is not a container like a bucket. It's an association between object types during object creation, destruction and picking. You might want Pin behaviour. (Not saying Container wouldn't be useful, just in a different way).

  • Yup, what codah says: you want the Pin behavior:

    https://www.scirra.com/manual/99/pin

  • > Make a scrollable table object that I can dynamically load sprites/text into. The "Container" behavior would allow me to move only one object in the container to scroll the entire table up and down.

    >

    A Container is not a container like a bucket. It's an association between object types during object creation, destruction and picking. You might want Pin behaviour. (Not saying Container wouldn't be useful, just in a different way).

    Yea, I already ran into that problem. That was why I asked my original question. If dynamically adding sprite instances worked, then I could create the sprite THEN associate it with the container avoiding the extra instances of everything else in the container.

    All of this could be avoided with an official table object though... lol.

  • Yup, what codah says: you want the Pin behavior:

    https://www.scirra.com/manual/99/pin

    I have to do more research into this. It looks like it might solve my problems though. Thanks!

  • If dynamically adding sprite instances worked, then I could create the sprite THEN associate it with the container avoiding the extra instances of everything else in the container.

    You add object types, not instances, to a Container. So it doesn't make sense to add them 'dynamically'.

  • Yea, I know, but I need instances added to the container, not object types for my particular purpose.

  • > Make a scrollable table object that I can dynamically load sprites/text into. The "Container" behavior would allow me to move only one object in the container to scroll the entire table up and down.

    >

    A Container is not a container like a bucket. It's an association between object types during object creation, destruction and picking. You might want Pin behaviour. (Not saying Container wouldn't be useful, just in a different way).

    Thanks codah. The pin behavior works perfectly. I have a scrollable/drag/droppable table now.

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