AnD4D's Forum Posts

  • Oh this is clever. I used canvas quite a lot in a few prototypes, but never got around to using this. Very nice indeed.

    Am I right in thinking there's no paste layer, as in canvas? I imagine it'd be easy enough to put all the objects into a family and paste them instead, right?

  • Play.Google - Development tools - Services/API's - Licensing & in-app billing

    Your license key for this application

    Lord bless this is a mess, but that's the key to use

    I stopped using PhoneGap in the end. It just isn't good enough. Use Cocoon instead.

  • You can set target angle to this expression:

    LiteTween Set Target to (currentlAngle<180 ? 0 : 360)

    This means "if current angle <180, then target angle 0, else target angle 360"

    Oh lovely, thank you! ...again!

  • AnD4D Just set the target angle to 360.

    It doesn't work like "anglelerp" because you might want to rotate from 0 to 720 for example, to make two full rotations. Anglelerp in this case will not move at all.

    Thing is, the object's initial angle when spawned in is set to either 0,90,180 or 270. But they will all turn to face 0, then return to their original position.

    If I just set it to 360, the objects that start on 270 will look fine turning to face 0, but those on 90 will have the same issue I mentioned. Rotating clockwise this time instead.

    Should I just not use this and set up a anglelerp function?

  • I'm having a problem using the angle tween.

    If I have a sprite set to 270 degrees (facing straight up) and I want it to face 0 degrees (to the right), when I give it a command to rotate to the new angle, rather than rotating clockwise 90 degrees, it will rotate 270 degree anti-clockwise. It's getting really annoying.

    I swear I've had this problem before, and needed to do a few expressions to resolve (for some reason I have %360 in my head, but not sure why, nor how to use it).

    Is there an action or setting I'm missing? For some reason it's seeing 0 degrees and 360 degrees as different angles... which I guess it true, but visually is the same.

    Is there a reason this behaviour doesn't act the same way Angle Lerp does?

  • > tarek2 Took me a while to understand the code. I couldn't see where you were inputting the range, but now see that you are doing it using the line of sight behaviour, which is very clever indeed. I didn't even consider doing that. Great stuff!

    >

    Hahha I can imagine hunting for that hiding part lol

    Thank you, That's a little trick I use when I don't want to use the Overlap is very helpful and limits the Los Range for performance, what I notice in all my experiments with Line of Sight is the more you turn up the Range the more expensive it becomes even if is not in use by the events

    I'm Glad, you like it, was really fun Puzzle to solve, if you have any questions that you don't understand in my Capx you can always ask me

    I do have one question, actually.

    If I look at the tile in debug during a test; if the selection number = 1, and I click on it, it doesn't change the instance boolean "Checked" to true (1). However, if I pick a higher selection number, such as 5, and then click the exact same tile, it will change the check boolean to true.

    Do you know why that is? Is that important? When I try to change the code so that it will allow such a thing to happen, things start breaking.

  • tarek2 Took me a while to understand the code. I couldn't see where you were inputting the range, but now see that you are doing it using the line of sight behaviour, which is very clever indeed. I didn't even consider doing that. Great stuff!

  • Here you go:

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

    The code is not optimized, but it works.

    AnD4D

    Haa I new Something will be no right, I thought you wanna follow the source where the Flood bigging, I miss understood this statement

    [quote:1seoeqpc]

    having the flooded parts remain in a second click, but spreading. By that, I mean, say you're using a flood of 5. When you click on a tile, 5 other tiles are highlighted.

    I fixed for you

    https://www.dropbox.com/s/x97zzeeoyt8dxtp/LimitedFlood_2.capx?dl=0

    This was really fun. My final version is very similar to dop2000, but strangely no where near as fast, nor efficient.

    Strangely enough, I'm noticing some unusual results. If you place a flood of 20 down somewhere, then change the flood number to 1, and click on one of the tiles, it'll seemingly change a tile in a random place, rather than one that is nearby.

    tarek2 Your version seems pretty much perfect. I'm going to play around with it a little bit more, as I'm quite attached to Dop's version <img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing">

    I really appreciate people helping me out with stuff like this. I'm likely to come up with more in the near future, as I'm trying out lots of little experiments <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • AnD4D

    I Love challenges so I give it a try

    Capx:

    https://www.dropbox.com/s/vu4b0v2dmgbkfoe/LimitedFlood_1.capx?dl=0

    This is based on what I understood but maybe I understood it wrong though

    Not bad, but if you click on one tile, then click on one far away, the original tiles continue to 'flow'.

  • I think this may be solved by replacing the mentioned distance event with a "nearest" event.

  • I can’t open the capx right now, but Here’s another idea. I looked a your first capx briefly when I was at my computer.

    Give the grid sprite a number instance variable and call it n. You’ll also want the origin of the sprite to be centered.

    Also create another sprite and call it detector. Make it’s origin to the left and make it’s size 32,4. I’m assuming the grids are 32,32.

    Global n=1
    
    On click
    —set n to 0
    —set grid.n to 0
    —if mouse is over grid
    ——add 1 to n
    ——set grid.n to n
    
    On click
    Repeat 50 times
    —If grid.n=loopindex+1
    ——set grid.opacity to 50
    ——set detector position to grid
    —Repeat 4 times
    ——Set detector.angle to 90*loopindex
    ——if detector not overlapping wall
    ——if grid overlapping detector
    ——if grid.n=0
    ———add 1 to n
    ———set grid.n to n[/code:3rd394h9]
    
    Change the repeat to the number of grids to highlight. Also I used opacity to do the highlighting but you can use anything.
    

    Thanks R0j0. Wouldn't the overlapping detector use more cpu than dop2000's above method?

    Imagine my grid is 16/16 made up of hundreds of tiles, with lots of flooding. I usually find that when I included collision or overlapping in my games, things start to slow down rather quickly.

  • Here is my attempt:

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

    Not sure if this is how you want it to work, but my version doesn't require "waits". And I also don't like using arrays <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Oh that is clever. I completely forgot that a sprite views it's family version of itself as a different thing.

    I'm now trying to push it a little bit further, having the flooded parts remain in a second click, but spreading. By that, I mean, say you're using a flood of 5. When you click on a tile, 5 other tiles are highlighted. Then if you click the exact same tile, 5 additional tiles appear, spreading out from the additional flood, meaning you're now covering 10 tiles.

    So no matter where you click, the flood will form from the clicked tile, but consider every already flooded tile as already flooded, and just move past it to an unflooded space.

    I've changed the code enough to get this working with 2 tiles, but after 4 clicks, it won't spread past it. I think it's something to do with the TileFloor.Width*1.1, but can't see why.

    I've uploaded your example which I amended here.

    http://bearboxmedia.com/apps/Temp/flooding_.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would go with some recursive function using "is over lapping", which is where it would all go horribly wrong.

    Luckily R0j0 will be along shortly to do it correctly.

    See, I did think of doing it with overlapping, in fact, I started to do it using offsets, but I can very rarely get them working, and fear that I'm likely to use too much CPU checking so many collisions.

    I've updated the original post's capx to show the new version.

    Now, for some reason, which I can't figure out, nor replicate using code... If I multi-click a tile, the code appears to run faster. Why might that be?

  • So you want a flood fill?

    Ahh, it has a name! Much better than my use of the word "flow". Heh!

    I've been changing the code here and there, and managed to get something close to what I want, but it requires a loop with a "Wait 0 Seconds" included to force the next skip. Every time I remove the 'wait' it stops working. I'm trying to store the position of each Flooded Tile, so perhaps the wait is useful.

    Do you know of a better way to do what I'm looking for?

  • You could use "pick closest", and compare distance() using a function and variable filtering.

    Thanks for your message, but that is what I've already done in the capx I posted a link to.

    It doesn't help in regard to the 'flow' effect I'm looking for.