Parent - children mechanics with instance sprites

Get help using Construct 2

Post » Tue Jul 25, 2017 8:18 pm

Message: S1mon can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
I already asked this question on another forum.
Image
I need to attach a sprite to the sprite (instance)
Red numbers - animation frames of the sprite
Blue numbers - ImagePoint ('Blue number')
At result i need sometning like this:
Image
P.S. Sprites angle at images is just for beauty. Don't take it into account.
CAPX:
http://c2community.ru/forum/download/file.php?id=18811 download
P.P.S. One kind person helped me, but in his example is no sprite instances:
http://c2community.ru/forum/download/file.php?id=18813 download
B
5
Posts: 6
Reputation: 462

Post » Wed Jul 26, 2017 2:24 am

If your image points are numbered exactly like that, then you can just give each "part" of your object an instance variable called something like "PositionID" and set it to the object.count of the instance upon creation.

You can then use a comparison of the instance variable value, and the image point you want to join it to.

It looks like you have all variances in a single sprite, so it should be really easy to set the positional ID as each part is created.
If you have multiple instances of this entire object, then you may need a second variable to identify the individual "master" instance, with the "PositionID" as the placement for the master.

Hopefully that all made some kind of sense...

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Wed Jul 26, 2017 8:48 am

@SoldjahBoy
thanks for reply.

I am already can change private variable PositionID equal to Object.AnimationFrame without setting it to the Object.Count:
Image
One of the problem it's to pick needed sprite for to perform actions on it. Can you, please, download my capx and show by example.
Image
It being too hard for me... :(
Last edited by S1mon on Wed Jul 26, 2017 4:42 pm, edited 1 time in total.
B
5
Posts: 6
Reputation: 462

Post » Wed Jul 26, 2017 10:24 am

B
38
S
22
G
63
Posts: 236
Reputation: 35,560

Post » Wed Jul 26, 2017 4:40 pm

@tarek2
Man it's looking very pretty cool!!! Thanks you!
Sorry for some my impudence... :? But... It's posiible do to that without families?
B
5
Posts: 6
Reputation: 462

Post » Thu Jul 27, 2017 12:39 am

Sorry @S1mon I'm at work so I can't check it now...

If you have two variables; one to define the entire instance of all combined objects, and a second one to define the individual parts of each instance...

So the first instance that is created, have a var called something like "UniqueID" and the second instance called "PartID" or "PositionID"or something like that... when you spawn each part for one particular instance, the unique ID would be the same (IE, all would be 1 for the first instance, but each PART would be 1,2,3,4,etc).

THEN you can compare the UniqueID (for the entire instance) and each Part/PositionID...

For each "thing"
-> UniqueID = UniqueID
----> Set position to PartID imagepoint.

In this way you have a "global" identity for which parts belong to which instance, as well as the positional identifier so it knows where to join on to the instance.

Kinds wish I wasn't at work... I've done this so many times with making several instances of the same "blank" character that use multiple parts... in almost every prototype or project I've worked on, I have a single "blank" that is instanced and used to make as many players or enemies as I want - all without using families or containers.

Speaking of containers though... you COULD easily use a container to create all arts at once, and easily reference all parts at once since they will automatically belong to the other objects in the same container. (Look up containers in the construct 2 manual) 8)

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Thu Jul 27, 2017 5:44 am

S1mon wrote:@tarek2
Man it's looking very pretty cool!!! Thanks you!
Sorry for some my impudence... :? But... It's posiible do to that without families?



@S1mon
No problem man

Without Family is not that simple and has to be done in more steps, This the only way I could think of now

https://www.dropbox.com/s/9wzvno5uy1yepp8/AutoBotNew.capx?dl=0


Edit: I just saw that SoldjahBoy may have a better solution :D
B
38
S
22
G
63
Posts: 236
Reputation: 35,560

Post » Thu Jul 27, 2017 10:33 am

@tarek2
@SoldjahBoy
Thank you very much, dear friends !!! I have long asked this question, and still could not solve it. Your examples and tips will be very useful to me in future projects, but for the current project I'm better off using not instances sprites, in favor of fewer events. Once again, thank you very much and wishing you all the very best! You awesome guys! :D :D :D
B
5
Posts: 6
Reputation: 462

Post » Thu Jul 27, 2017 11:03 am

@S1mon

Yw sir, I'm glad to help

you say "still could not solve it." If you explain in more detail and exactly what you tried to accomplish with this Perhaps some else can give you the right solution, starting with how many limits of Events you have to do this Task. Trust me will be more helpful if some one else tries to resolve the problem, there are many Good brains around here you never know they could come up with the solution but you have to be more specific. :D

Take care Bro
B
38
S
22
G
63
Posts: 236
Reputation: 35,560

Post » Thu Jul 27, 2017 3:02 pm

@S1mon

Try this >> Two events Only but Double objects

https://www.dropbox.com/s/i8ckxeycpz1r13a/AutoBot3.capx?dl=0
B
38
S
22
G
63
Posts: 236
Reputation: 35,560

Next

Return to How do I....?

Who is online

Users browsing this forum: David181, evillair and 52 guests