Parent - children mechanics with instance sprites

0 favourites
  • 12 posts
From the Asset Store
Add emotion, innocence, joy and cuteness to your video game with these 15 songs and 9 SFX
  • I already asked this question on another forum.

    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:

    P.S. Sprites angle at images is just for beauty. Don't take it into account.

    CAPX:

    c2community.ru/forum/download/file.php download

    P.P.S. One kind person helped me, but in his example is no sprite instances:

    c2community.ru/forum/download/file.php download

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • SoldjahBoy

    thanks for reply.

    I am already can change private variable PositionID equal to Object.AnimationFrame without setting it to the Object.Count:

    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.

    It being too hard for me...

  • tarek2

    Man it's looking very pretty cool!!! Thanks you!

    Sorry for some my impudence... But... It's posiible do to that without families?

  • 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

  • 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

  • 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!

  • 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.

    Take care Bro

  • S1mon

    Try this >> Two events Only but Double objects

    https://www.dropbox.com/s/i8ckxeycpz1r13a/AutoBot3.capx?dl=0

  • tarek2

    you say "still could not solve it."

    Sry 4 my bad English

    I meant that I could not solve it until you helped me. Not "still"

    And You right that many bright minds are here! One of them belongs to you

    ~tnks bro

  • tarek2

    > you say "still could not solve it."

    >

    Sry 4 my bad English

    I meant that I could not solve it until you helped me. Not "still"

    And You right that many bright minds are here! One of them belongs to you

    ~tnks bro

    jeje Lol, that sounds a lot better I thought that you gave up as you couldn't find the right solution, I'm glad that you resolve the problem then.

    Haa I'm just a beginner learning new things every day but Thank you for the compliments thogh

    Take care

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