Juryiel's Forum Posts

  • I was wondering if I can somehow make a simple change so that if i resize the window, the size of the cells stays the same but I can see mroe of them. I'd like to use this to edit a very large array so this would help if possible.

  • Huh, it's getting weirder now. I also have an Is Dragging condition under the Is Var1 Equal to 0, but that does not activate, only the On Drop does. Now I'm really confused since if one is activating so should the other (they're under the same conditions, and you need to be dragging before you drop).

  • And if I replace the Invert Left Mouse button is down with On Left mouse button released, then the first click always triggers the On Drop condition. If i add a delay of 150 ms prior to setting Var 1 to 0, then it seems to work, though it is possible that the delay just makes the occurance more rare. Any idea what's going on? Seems like maybe there's a timing issue with the mouse / keyboard object perhaps? Or maybe I'm doing something wrong.

  • Another drag and drop issue (which may not be a bug)

    I have this code:

    On Click Object1 --> Enable Group 1
    
    ===Group 1=== (Deactivate by default)
    Is Var1 Equal to 1
      +[Invert] Left mouse button is down  --> Set Var 1 = 0
    
    Is Var 1 Equal to 0
      +On Drop Object1 -->  Do stuff[/code:3dztzwo3]
    
    It appears that the first click on Object1 (the one that activates group 1) once in a while triggers the On Drop condition.  It seems like it shouldn't since the left mouse button has to not be down before we get to that subevent.  And yet, once in a while it seems to do it.  Any ideas why?
  • So I have a bunch of units (sprites) in a board-game type of setup. There are two phases. In one phase, I click on the units and give them orders. In another phase I enable drag and drop behavior (deactivated in phase 1) to issue moves.

    The problem is, when I activate the drag and drop behavior, the units I clicked previously seem to enter "Being dragged" phase even though I use a Button to change between phases, and even though my mouse button is not, in fact, being held down. I can attach a cap but it's pretty confusing, so if any ideas come ot mind quickly let me know. Thanks

  • Oh I see, your Repeat is not nested under the picking for the first sprite. Huh, I guess I must not understand how picking works, removing the Repeat from the nesting makes everything work but I don't get why.

    Thanks though

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

  • Try Construct 3

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

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