matriax's Recent Forum Activity

  • And without bound to layout even better..

    As you can see I use use the clamp() expression to limit the x and the y position of the object..

    Oh! i see thanks!

  • Well, you have this event:

    Enemy worm head is outside of layout

    > set worm advise x - to enemy head x

    > set worm advise y - to enemy head y

    So they are at the same spot..

    I always thought two things in the same spot have a distance of 0

    So the text is completely right..

    But you forgot the Advise have a "Bound to layout" so the advise not is spoted at the enemy because he can't move. to the X or Y <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> .

    If you set ever 0.1, etc... like chadorireborn says, the distance works correct.

    Look this:

    https://dl.dropboxusercontent.com/u/659 ... ance2.capx

    EDIT: I guess is a conflict with "bound to layout" that not left the advise go to the enmy and the distance that seems that to work too fast appears 0. Sure if i get another event instead "bound to layout" that works equals the distance will be fixed. But i don't know how get the same thing in the advise to appeasrs only around the layout without the "bound to layout" behaviour.

  • I see, with 0.3 works, also with 0.1 .

    Other idea is create another sprite, a circle one with 150x150 resolution pined at enemy_advise, and when the enemy overlaps change the animation.

    But well if somebody can fix it correctly using distance and savind add more sprite and events will be great.

  • Here: https://dl.dropboxusercontent.com/u/659 ... tance.capx

    When the head of the worm is outside the layout the distance is always 0 ¿?

  • I actually have:

    Distance(enemy_advise.x,enemy_advise.y,enemy_worm_head.x,enemy_worm_head.y)

    The idea is that i'm showing an alert when a enemy is created out of the layout, and an icon advise you. So First the icon is yellow, and my idea is that when the enemy is near(Low distance) change to a red color to give the idea will be appear in the screen inmediately.

    But the distance expresion only works for objects that are in the screen, when the enemy is out of layout the distance is always 0 . I'm doing something wrong? How can i fix it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Should be easy, if you set everything up correctly..

    If you are creating family sprites through events, you should use

    on family normalmaps created

    pick family sprites nearest to normalmaps.x,normalmaps.y (or use is overlapping)

    >family normalmap pin to family sprites

    I finaly get working similar like you say, this is the way worked:

    -----------------------------------------------------------------------

    on (Family)NormalMap created

    (Family) NormalMap is overlaping (Family) Sprites

    (Family) Sprites | Pick nearest to (Family)NormalMap.x, (Family)NormalMap.y

    DO > (Family)NormalMap pin to (Family)Sprites

    -----------------------------------------------------------------------

    Without the overlaping condition or the "Pick nearest" not works correctly, booth are needed to work perfect.

    -

    Edit: This is the capx to see

    https://dl.dropboxusercontent.com/u/659 ... fixed.capx

  • [quote:gc597px3]The reason it works in the start of layout is because you use pick nearest of the sprite-family and I guess the nearest is the right one..

    Correct, without the "pick nearest " not works.

    [quote:gc597px3]I would use the sprite-family on created, pick nearest enemy and pin, because it's possible that the sprite-family object doesn't exist yet on enemy-family created..

    Enemy-Family? or you mean the NormalMap-family?

    I tested various options like "on created & pick nearest > pin" or "On created & Is overlaping > pin" but nothing worked .

    I put a Feature Request here: . An option inside the Containers property to pin-to-pin the desired objects. With this i guess all this events discussed will saved, right?

    I will continue on day more trying to find the solution if not i will create a "NormalMap" group and add there all the pin-to-pin objects individually. Hope the admins ear this and add some feature to save all this in the future.

  • I don't understand..

    You want to pin objects that don't exist on start of layout?

    You can't perform actions on objects that don't exist..

    Then, why works? , This event actions works for me:

    On Start Layout

    for each (Family) Sprites

    (Family) NormalMaps | Pick nearest to ( Sprites.x , sprites.Y) -> Do (Family) NormalMaps Pin-To-Pin (Family) Sprites (Position&Angle)

    I have various objects in the layout that have a container that includes another that is the NormalMap, and when the game runs, with the previous event, every object creates their own NormalMap and gets pinned, so it's already works!. I guess the container action is made before the event "on start layouts" started, but as i said it's already works. Maybe to be more correct i have to change to "On loader layout is complete", but as i said it already works.

    -

    So, for the objects that are already in the layout before the game runs they create another object that is the normal map and gets pinned. They are asteroids that move and rotate and as i said works, try it yourself if not believe me.

    Also i already have working that when a specific/individual object is created get the normal map pinned, but i can't get it working for a family and that's my question.

    I have that every X seconds an asteroid is created. This asteroid have a container that includes the NormalMap image. If i add this event works:

    On ObjectX created -> Do ObjectX_NormalMap Pin-To-Pin ObjectX (Position&Angle)

    So the idea is made that instead of add an event for every object created pinn to their normalMap i want use an event with family or similar to do the same like in the "on start layout" and save add events for every type of the objects created.

  • I'm setting the NormalMaps to every object and for the objects that are already in the layout works perfect using this:

    On Start Layout

    for each (Family) Sprites

    (Family) NormalMaps | Pick nearest to ( Sprites.x , sprites.Y) -> Do (Family) NormalMaps Pin-To-Pin (Family) Sprites (Position&Angle)

    Every Sprite have in their container the NormalMap image. With this i can add all the different sprites/normal that i want and they will be pinned, so if they move, bounce or whatever no problem,

    But how i do the same for sprites that are created previously? i mean during the gameplay .

    I can do it for every sprite individually using this:

    On ObjectX created -> Do ObjectX_NormalMap Pin-To-Pin ObjectX (Position&Angle)

    But how to do using families or with an event that works for all the sprites like the "On Start Layout", to no create a PIN event for every object in the game with normal map that will be create during the gameplay.

  • Actually you have containers that add some objects in the same time other is created, but if you want the object created follow the other object/s in the container you have to create an event for it.

    So will be great that in the object properties, inside the container add maybe the "Pin-To-Pin" icon for each object added and pressing the icon will enable/disable the Pin-To-Pin function, in case you only want some of the objects created follow others.

  • I guess you could work with the pickedcount expression..

    Than the event would become something like:

    family compare variable = 0

    System compare two values: family.pickedcount = 5

    > family destroy

    Worked Perfect! A lot of thanks!

    Can you explain a bit? I not understand very well what is really doing this condition

  • I think you're using families wrong here, unless you're planning to have more creature types in future? You can set up the worm as a 'container', this then means that when one part is destroyed, they will all be destroyed. They're useful for this. Families are for affecting a family of objects at once i.e. a number of different kinds of worms rather than parts of a single object. If they're a container then this logic might work because if you pick a part of the worm to check against then it will pick every other part of the worm as well.

    The problem is that i only want to destroy the enemy when all the parts have life=0 .

    I mean, i can hit until the head of the worm get life=0 but only when all the parts of the worm have life=0, this means head and the 4 body parts be destroyed.

    I can do that when the head or the body is life=0 destroy, but the problem is how destroy the entire worm only when all the parts are life=0.

    Which expresion i have to use in Construct2 to compare a serie/group of instance objects that when match some criteria do X action?

    I mean, i also tried to use expresions without family only direct to the object, body and head=0 then do action with the same result.

matriax's avatar

matriax

Member since 22 Jun, 2015

Twitter
matriax has 114 followers

Trophy Case

  • 9-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • Viral Game One of your games has over 100,000 players
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

17/44
How to earn trophies