Speedy1SonicBoy's Forum Posts

  • I'm not sure I can answer your question. Your game is pretty complex, and while switching to hierarchies has probably made things a bit cleaner and more organized, it's still a complex system.

    All I can do is share how I would probably approach this task:

    1. Pick all moleks that are still in the hierarchy (i.e. children of Chemic). First, set attached = false for all of them.
    2. For each molek in the hierarchy that is directly overlapping (touching) Chemic: set attached = true.
    3. For each molek in the hierarchy with attached=false: check if it’s overlapping another molek with attached=true. If so, change its attached to true. (You might need to use a family: “Molek is overlapping MolekFamily.”)
    4. Repeat previous step until none such moleks left.
    5. Any remaining moleks in the hierarchy that still have attached=false at this point have broken off from the chain. Remove them from the hierarchy and launch them away.

    This helps. How would Step 3 look like?

  • So the easiest fix is this:

    > + Molek: On destroyed -> Wait 0 seconds
    ----+ System: Pick all Molek
    ----+ System: For each Molek
    
    

    That works... too well. Lol Now I'm having instances of molek fly off that are part of other chains.

    How would I be able to isolate only the affected chain, what in the conditions below would I have to amend/add?

  • I just realized I had a line similar to this, and added the add key line in the end. I'm assuming it needed a value of 1 so that's what I put down.

    What's next?

    This is what I put down underneath the main clause that breaks the chain visually, but so far it does nothing. Is there anything here I'm missing? Or might I be missing something somewhere else?

  • Here is an example:

    > Chemic pick children Molek
    For each Molek
    ... Dictionary add key Molek.dx & "," & Molek.dy
    

    I just realized I had a line similar to this, and added the add key line in the end. I'm assuming it needed a value of 1 so that's what I put down.

    What's next?

  • One other thing to consider about the hierarchy system: it doesn't support loops. So if you need looped chains, like in the image below - you’ll have to connect all Moleks directly to Chemic.

    In that case, when any Molek is removed, you'll need to check which Moleks are still connected to Chemic and rebuild the hierarchy accordingly.

    Good to know! Looks like I'll have to do that to support loops. Still, building a dictionary from hierarchy... how would I go about doing this?

  • There are two ways to build the hierarchy: either attach all Moleks directly to the parent Chemic, or create a chain. I’m guessing the chain would be more suitable in your game. If a middle (blue) Molek in the chain is removed, it will automatically break into two smaller chains. Or you can detach pink molek from yellow as well.

    I'll try for the latter case in this instance. Basically anything breaking off from the chain will act as they would if Z were pressed, and (in this example) pink and yellow would bullet out of there separately from each other.

    I’d strongly suggest using the hierarchy feature instead, it will be A LOT easier. Attach Moleks to Chemic as children - this way, they’ll automatically move together and stay logically connected. You won’t need dictionaries or extra variables at all. You can find parent or child object at any time with "Pick parent/child" condition.

    The dictionary will be necessary for another aspect of the overall project that this stems from, where I'll need to call on it for an overall shape to be built, checking if numbers match the shape intended.

    construct.net/en/forum/construct-3/how-do-i-8/check-shape-built-185425

    It seems to be the only thing that works so far, and to remove the dictionary entirely would mean to overhaul this system that's worked for me.

    With all this in mind, where would you suggest the overhaul begin?

  • There's more to the code than I can successfully screenshot, I'll be able to show you via the project file itself:

    drive.google.com/file/d/1x-GN_g_PbKfzClApM8vNFcr6RX3ITA5r/view

    Bear with me, the link should work, but I'm not entirely sure how to do it with Dropbox, so I did it through Google Drive instead.

  • The chain is made with events.

    So the initial part of the chain is the Chemic itself, then another Molek or set of moleks that will then be destroyed upon touching alpharay. (Or betaray, which I don't have in the example but I do have in the rest of the project.)

    Thing is, I tried the condition of overlapping Chemic or Molek but neither worked.

    I think the solution might have something to do with the markers themselves. Maybe if I can have the system check if 4 markers can be looped around a molek, for it to then detach.

    How would I go about making that a condition, however?

  • I have a unique problem in my hands.

    So I have a system that attaches sprites in a chain. When that chain breaks, I hope that the sprites detach accordingly. Unfortunately the below circled sprites act as if still attached!

    I've already figured out how I'd want the sprites to act. The question is this: what do I put in the conditions tab to make it so the system checks for a break in the chain?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Set rotateSpeed to lerp(rotateSpeed, 0, 0.05)?

    After a few tweaks, that seems to be it! Thanks!

  • Couldn’t you just use the bullet behavior, and rotate behavior but gradually reduce the turning rate to zero?

    Behaviorless is similar and easier for me to write off the top of my head and would be:

    Every 1 second
    — create bullet at sprite.x, sprite.y
    — bullet: set angle to random(360)
    — bullet: set turningRate to random(30,120)
    
    Every tick
    — bullet: move forward 150*dt pixels
    — bullet: set turningRate to lerp(self.turningRate, 0, 0.05)
    — bullet: rotate self.turningRate*dt degrees

    If you used behaviors then you’d basically reuse the action that sets the turning rate to some extent.

    If I'm reading this right, then the turning rate in behavior form would be the rotate speed. In that case, since I am using behaviors, how would I gradually reduce the rotate speed to 0?

  • Can you draw a picture of that spiral path?

    Here is another behavior you can use:

    https://www.construct.net/en/make-games/addons/198/spline-movement-c3-runtime

    Demo project:

    https://www.dropbox.com/scl/fi/b7znsclmmgnkzpi8cracv/spline_demo.c3p?rlkey=9fogcjirerhfodmvbwwmxj8sw&st=3t05wgrv&dl=0

    I have a feeling this will be helpful, so I've already installed the addon.

    The object that I plan on using this for (the αray, in this example) will spawn from something else. It will take a path between a slight curve and a fibonacci spiral, again depending on rng.

    So, from something like this:

    to something like this:

    And anything in between.

    But here's the thing: The spawn point (The green ball) will also be moving. That part I've already figured out with spline addon, but as for updating several instances of an invisible sprite around the object at the time of the spawn, that's where I'm scratching my head.

  • I'm open to the tween and move-to options. Not so much the timeline, as I've found even with easing the movements can be choppy.

    Plus the spiral will have to get bigger or smaller, based on RNG.

  • I'm trying to guide an object along a spiral path to the edges of the viewport.

    Any help, as ever, is appreciated!

  • Hopefully this helps you understand the logic so you can move on with your project:

    It's been a massive help. With some personalizations, it works. Thanks! :)