How do I add Sprites to a Container dynamically?

Get help using Construct 2

Post » Mon Dec 15, 2014 11:44 pm

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.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Mon Dec 15, 2014 11:49 pm

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.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Mon Dec 15, 2014 11:53 pm

Well... mostly I want the uniform motion, which I can do mechanically, but I was hoping I could just add them to containers dynamically. :(
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Tue Dec 16, 2014 12:20 am

gumshoe2029 wrote: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?
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Tue Dec 16, 2014 7:32 pm

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.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Tue Dec 16, 2014 8:30 pm

Are you sure about that? ;)
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Dec 16, 2014 9:13 pm

gumshoe2029 wrote: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).
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Dec 16, 2014 10:37 pm

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

https://www.scirra.com/manual/99/pin
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Wed Dec 17, 2014 5:45 pm

codah wrote:
gumshoe2029 wrote: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.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Wed Dec 17, 2014 5:46 pm

TiAm wrote: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!
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 3 guests