Select/manipulate an object from Family?

0 favourites
  • 11 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hello everybody. After some days of search i've decided to aks/post it here.

    I have:

    • Object 1
    • Object 2
    • Object 3
    • A Family containing 2 Objects

    I want:

    • Object 1 in collision with Object 2, Object 3 subtract 1 from Health (i did this and working fine)
    • On each collision between Object 1 and Object 2 (and after subtract 1 from Object 3 - like above), i want an (1) object from Family to set angle at X degrees (can this be possible?)

    Why i want this? - The two objects found in Family, can be in other areas of the Layout so i don't want them to flip/set angle if in another area (when Object 1 and 2 collide), but only when they are overlapping Object 3 (or something else, another object, for example.)

    To try to explain more simple, i would like, when Object 1 collides with Object 2 (and subtracts 1 Health from Object 3), 1 Object contained in the Familly to do an action (set angle for example).

    So, as i see it, in theory would be - Object 1 on collision with Object 2, subtract 1 Health from Object 3 + If Family overlaps Object 3, set angle to X of an object from inside the Family. If Family (the 2 Objects inside) wont overlap Object 3, then no object from inside the Family will set angle. I hope i explained accurate, but if any questions please ask and i will tell.

    Thank you all!

  • You won't be able to do this grabbing them as a family... since the whole purpose of the family is to allow you to act on whole groups of objects together.

    However, you can still pick items from inside the family themselves without using the families pick...

    If you only have 2 inside family then make two events, one saying in item1 overmaps, item2-set angle and another with item2 overlap and item1 set angle...

    unless I am just not understanding what your trying to do.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • does it matter which object from the family? you could pick random... that only picks one object.

  • - interesting ideea, but in time that family will have maybe 20 objects (or more) and also in time, i will have another object colliding and subtracting 2 or 3 from health, and i need on every subtract, the value i subtract will turn at X angle the objects in family.

    jobel - NO! it dosen't. I tought of that also, but don't know how to. Can it be done?

    To add more info to what i want: On every X subtract, X object(s) from the Family (random or not) should set angle degree to X. For example, if on collision 2 Health will be subtracted, 2 objects from the Family will set angle, and so on.

    Thank you both for reply!

  • NO! it dosen't. I tought of that also, but don't know how to. Can it be done?

    simple.

    Object 1 OnCollision with Object2
               System-> Pick Random <object>
                            Set <object> Angle etc...[/code:3om9lvxv]
    
    for "object" you'd insert the Family you want.
    
    
    

    On every X subtract, X object(s) from the Family (random or not) should set angle degree to X. For example, if on collision 2 Health will be subtracted, 2 objects from the Family will set angle, and so on.

    what is this first part? "On Every" on every what? tick? X seconds?

    Is the number of family objects that you want the angle set have to do with how much is subtracted from the health?

    if so.. make an instance bool variable called "selected" on the Family object..

    Odamage=2
    
    If Object1 OnCollision with Object 2
         Repeat Odamage times
            Pick all Family
            Family is selected
                 Pick Random Family
                       Family set angle
                       Family set selected to TRUE[/code:3om9lvxv]
    
    after the collision is over you need to reset all the selected to false.
  • best to post a dropbox link to a capx..

  • Let me explain better what i wanna do:

    1. Object "A" on collision with Object "B", Object "B" add n to Health.

    2. Object "C" on collision with Object "D", Object "B" subtract n from Health.

    3. After Object "B" subtract n from Health, n Object "A" set angle to 90 degrees but only if/when n Object "A" is overlaping Object "B".

    (n can be any number)

    Why only if Object "A" is overlaping Object "B"? Because i will have many Object "A" and i don't want them to set angle to 90 degrees if they are not overlaping Object "B", cos if so, they will be setting angle to 90 degrees while they are in other areas of the layout.

    If you know the game "Magic: The Gathering", when you use a card, another card (resource card) will be Tapped (tapped means will set angle to 90 degrees) thus showing the player the card is "used". I want the card to be tapped when overlaping object B, and not be tapped when "in hand".

    Thank you!!!

  • Any help?

  • Nothing?

  • 1. Object "A" on collision with Object "B", Object "B" add n to Health.

    2. Object "C" on collision with Object "D", Object "B" subtract n from Health.

    3. After Object "B" subtract n from Health, n Object "A" set angle to 90 degrees but only if/when n Object "A" is overlaping Object "B".

    So what part of this isn't working, it seems pretty straightforward..

  • Part 1 and 2 is working, part 3 is not (i don't know how to).

    I would like the solution to part 3 - After Object "B" subtract n from Health, n Object "A" set angle to 90 degrees but only if/when n Object "A" is overlaping Object "B".

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