Juryiel's Recent Forum Activity

  • Yes, that's exactly what I mean. Why does Grid Filter is Red, Grid overlaps Grid work, whereas my same implementation except using:

    Repeat Range
           Sprite PV IsPicked=1
           Sprite overlaps Sprite  ---> Sprite IsPicked set to 1
                                             ---> Sprite Set filter to red[/code:139omtv6]
    
    ...not work?  It seems identical.
  • The problem is that of course the list would change so it can't be in a container.

    Firstly, it's NOT one of the sprites on which I check for overlaps that are being dragged. The sprites on which I check overlaps stay still. Other objects that are on top of those sprites are being dragged.

    Here, let me try ot make it more intuitive

    Imagine a 10x10 grid of square sprites that overlap their neighbors by 1 pixel. I have an object on top of one of those sprites somewhere in the center of the 10x10 grid, and I want to be able to move the object a radius of N. When the player drags the object, the radius of N sprites is highlighted to let the player know where they can drop the object. Ideally a distance expression would work for this above example, but instead of a 10x10 grid, teh sprites are in this case not necessarily equidistant as a function of their range (N) from the object (e.g. instead of physical distance and range, if you think of a network of sprites with varying sizes and locations of overlap, what i want to get is the distance of radius N in connection space)

    When I drop an object, the sprite associated with it would change to the sprite on whcih I dropped it, so if I made a container that wouldn't work. Furthermore, it is possible to drop multiple objects on the same sprites, so although each object is associated with a specific sprite, the converse is not true, such that each sprite is not associated with just one object, it could be associated with multiple objects.

  • They're all instances of the same object created using Create Object during runtime.

    There will be a bunch of sprites (say, 100). There will be some other objects (say 10), and each of those 10 objects will correspond to one of the 100 sprites (so only 10 sprites will have objects corresponding to them). The function will be called when I start dragging one of the objects. I want to highlight the Sprites so as to indicate to the player that the object may only be dropped on one of those highlighted sprites and not on any other sprites. I want to then be able to check if the object was dropped on one of the highlighted sprites, and get that Sprite's ID and a variety of other attributes. The reason I want it to be recursive is because some objects will have a larger list of sprites they can be dropped on, so think of it as a range. A range of 1 allows an object to be dropped on only on sprites overlapping its corresponding sprite. A range of 2 allows an object to be dropped on sprites overlapping it's corresponding sprite, as well as sprites overlapping those sprites. And the list grows like that for each increase in range.

    Picking the sprite to start from is trivial and works. Creating the range=1 list is also trivial. Growing the list seems to not work if I do it by loop, though I can grow it manually by nesting a bunch of Sprite Overlapping Sprite events as indicated in the 4th post on the thread.

  • Actually I don't want to exclude previously selected sprites. I just want to build on the list. So a specific example:

    Sprites 1 overlaps 2 3 and 4

    2 overlaps 5 and 6 (and also 1)

    3 overlaps 7 and 8 (and also 1)

    4 overlaps 9 and 10 (and also 1)

    First I pick sprite 1

    Then I pick sprites 1 2 3 and 4

    If I iterate again I pick sprites 1 2 3 4 5 6 7 8

    and so on and so on.

    I thought the code in my above post would do it, but it won't. Still need help =/

  • Hmm, why isn't this code doing it?

    Pick Sprite 1 -> Spite set IsPicked to 1
    
    For 1 to N
    ->Sprite: Pick by evaluate Sprite.Value('IsPicked')=1
        -> Sprite overlaps sprite  --> Sprite set IsPicked to 1[/code:g76ca2gi]
    
    Shouldn't each loop iteration pick all the sprites returned by Sprite overlaps Sprite, thereby picking more and more sprites each time?
  • Yeap, using a PV will work. I'm just trying to avoid adding PVs if I can do it without it. I was hoping I could somehow recursively or otherwise apply the same 'Pick' filter to the picked objects list an arbitrary number of times. I'll use a PV to solve it if it's not possible otherwise though.

    EDIT:

    Example

    Sprite overlaps sprite
    [ul]
    	[li]> Sprite overlaps sprite[/li]
    [/ul]     ->  Sprite overlaps sprite
              ............
                    -> Sprite overlaps sprite[/code:3fp1lo8e]
    
    So the result of doing that N times.  Notice that each is a subevent of the previous one, so it's operating on the items picked by the previous one, which is different from:
    
    Sprite overlaps sprite
    Sprite overlaps sprite
    Sprite overlaps sprite
    etc.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh I also tried using recursion (e.g. have a function that calls itself some number of times) but Construct crashes when I try that =/

  • I have a pick operation, if Sprite overlaps Sprite. I want to be able to repeat this an arbitrary number of times based on some variable, but I want each instance of the pick condition to remember the previously picked objects and run the condition with them. For example:

    If Sprite1 overlaps Sprite, Pick all those sprites

    If those picked sprites overlap other sprites, pick all those other sprites too

    and so on and so on

    I can do this a set number of times by making a chain of Sprite overlaps Sprite subevents, but looping doesn't seem to work since each Sprite overlaps Sprite is not done as a subevent to the previous ones, so it starts the picking process all over from scratch.

    Any ideas on how I can do this?

  • Thanks, that worked

  • So if I implemented this correctly, it seems to be picking sprites overlapping either Sprite1 or Sprite2, whereas I wanted to pick sprites that overlap both Sprite1 and Sprite2 simultaneously. While this picks the union of those sprites, I wanted to pick the intersection. Sorry if that wasn't clear.

    EDIT:

    Just to avoid further confusion, an example is this:

    Sprite1 (corresponding to ID=foo1) overlaps Sprites 5 8 9 and 10

    Sprite2 (corresponding to ID=foo2) overlaps Sprites 3 4 5 and 9

    I want to pick sprites 5 and 9, as they are in both lists.

  • Oh great, that works, thanks!. Still having trouble figuring out how to use that now to pick the sprites overlapping those two sprites while excluding the two sprites themselves. Any help would be appreciated!

  • I guess I should also say that the above is only a step towards another complicated picking goal.

    The end result I want is this:

    The 10 sprites are overlapping each other with some sprites overlapping other sprites. The end goal is that when I mouse over Object1, I pick all sprites that overlap BOTH the sprite that corresponds to Object1.Value('Var1') AND the sprite that corresponds to Object1.Value('Var1'). Those 2 sprites themselves should be excluded from the picked list and only the ones that overlap both of them should be included.

Juryiel's avatar

Juryiel

Member since 30 Sep, 2010

None one is following Juryiel yet!

Trophy Case

  • 14-Year Club
  • Email Verified

Progress

15/44
How to earn trophies