R0J0hound's Recent Forum Activity

  • I fixed that issue so redownload. It should always show the answer sequence now.

    I don’t understand the first part of your question though.

    Best I understand you have want three four digit answers. One you can specify and the other two are shuffled versions of that.

    I had the digits start at 0 instead of 1, but all the numbers will be shuffled versions of 0123.

  • The second example does that. You specify the sequence in the global variable and it’s placed in one of the three groups of three.

  • To do what you want you mainly have to just rearrange the events you used in your original post:

    for each good
    bad: pick closest to good.x, good.y
    -- distance(good.x, good.y, bad.x, bad.y) < 200
    -- -- good: move toward bad
    -- else
    -- -- good: shoot toward bad

    But like the others suggested it can be good to put a bit more thought into the targeting. For example below I had each bad can be targeted by one good at a time, but that was mainly to prevent the good objects from overlapping over time.

    dropbox.com/s/a9a075lrxu45yjx/targeting_closest.capx

  • Ah, that's a bit different.

    Here's one way.

    dropbox.com/s/k4pdvewd4qbp4y8/shuffle_combinations.capx

    And modified if you want a specific combination included in the mix.

    dropbox.com/s/fv39mxvfsx41vsn/shuffle_combinations_with_a_predefined.capx

  • I suspect the issue has to do with the size of the drawing canvas.

    Don’t make it the size of the layout, just make it the size of the screen, and position it to the scroll position.

    You could make the draw reactance still cover the layout, or just make it cover the visible view area.

    Since it is visual effect you don’t need it to be bigger than the screen. Besides that will save video ram too.

    Anyways the reason the size of the canvas is probably causing your issue is the canvas is using a texture and webgl has a maximum texture size per device which is smaller than that layout size.

  • I've heard advanced random can generate a list of non repeating combinations but I haven't used it.

    Here's one way to generate an array of all the combinations. One idea more in addition to the other answers is you can store random(1) in the first column and then using sort(x) will effectively shuffle the array.

    dropbox.com/s/o2xmtjo8yqkid56/combination_shuffle.capx

    That just loops over that list of pairs which may be fine.

    An alternate idea is to just generate a random pair every time and check it against a history of the pairs of numbers. It will keep generating a random pair till it's unique. For example this is guaranteed to a not duplicate a pair of values for at least 5 turns.

    dropbox.com/s/xptgru4msx1rkz5/combination_history.capx

  • Ah, I see. Yeah, doing what you want is much simpler than what I proposed. I'd say still use the drawingCanvas. You can even use it to make the shadows from the objects directly.

    This clears the canvas, rotates the trees 221 degrees, pastes trees to canvas, return the trees to 0 degrees, then draws a black rectangle with the "source in" blend.

    dropbox.com/s/3noo9ie08ckvx6r/shadow_blend_simple.c3p

    Or instead of rotation, you could use distort meshes to make a skew.

    dropbox.com/s/qczxy22l8tr936s/shadow_skew.c3p

  • I think the drawingCanvas example would be the simplest one since it just uses the z order of the objects.

    Do you have an example project of how you set up the objects? If the shadows and objects are in one family then that’s fairly simple. If instead it’s an assorted variety of objects then that is a bit less simple.

    The verbose pseudo code of what we want to do is this:

    For each object ordered by zorder
    — is a shadow? Make visible and set opacity to 100
    — is not a shadow? Set blend to destinationOut
    — paste object
    — set blend mode to normal
    — is shadow? Make invisible

    But with events there are some simplifications.

    Anyways, with an example of how your objects are setup I could make a more specific example.

  • So here are some ideas. For an example I had a few solid green balls that are in front of and behind some blue clouds. The goal is for the clouds to be uniformly blended together. I went for the simple case of one object type, so you'd either have to use a family or do something more complex for multiple types.

    The first basically clones the first layer onto a second. Then all the objects are given 100% opacity and the solid objects have destination out.

    dropbox.com/s/vhegleb8dry4l15/shadow_blend_clones.capx

    The second C2 example uses the third party paster plugin. All the objects are drawn to the paster, but the solid are erased.

    dropbox.com/s/q893tdqvcaqmgu5/shadow_blend_paster.capx

    The C3 version using the drawing canvas. Basically the same as the paster one.

    dropbox.com/s/i7nl6hvrgdlkyhy/shadow_blend_c3_canvas.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I’ll try to make an example tomorrow. Basically one layer would be just the objects, and the other layer would have objects and shadows, but the objects are subtracted away.

  • Besides a layer I suppose you could use a canvas instead.

    Draw all the shadows to the canvas with full opacity and all the other objects with a “destination out” blend. Then you can set the canvas’ opacity.

    I’m a bit iffy if the paste action be used like that in c3. You’d need to draw things in order.

    Another idea that would work is a layer. All the shadows are there and clones of all the objects with “destination out” blends. May be a bit tedious to work with though.

    What it comes down to is if we want multiple shadows to be equally transparent, even in the overlapping areas, we need to draw them full opacity together first and then make them transparent.

  • Here's one possible solution.

    For each of your items you'll want to store a "mask" of what squares it occupies within it's rectangle. So for a gun it could be:

    1111
    1000

    So when you drop an item into an inventory you'd only need to see if the 1 places were unoccupied as well as inside the array. If all the 1 were then you could then place the object in the inventory.

    Here is an example without arrays, although you could certainly use arrays instead. I'm just using "is overlapping point" instead of an array lookup. It handles placing and removing items, as well as throwing them out if they are placed in an invalid spot. Perhaps some of the ideas here are useful.

    dropbox.com/s/tpwx74fq1c43auc/Fit_shapes_into_slots.capx