Speedy1SonicBoy's Forum Posts

  • 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! :)

  • The easiest way I can think of is Having a spawn state Boolean attached to the game/player state.

    If PlayerState = CutScene

    Set Var CanSpawn false

    Then add a condition on the call function like

    If CanSpawn = true

    Call function.

    If that makes sense. That would be the easiest way to do it.

    Then if you want it to spawn one on a timer, You can attach a timer to each molecule,

    When spawn, start timer, after X seconds set CanSpawn to true. Spawn the molcule then set CanSpawn to False....

    That works some.

    What makes it tricky is the spawn after the last molek gets attached. The attached state is a boolean as well, for the molek sprite. So another molek should spawn immediately after and reset the timer each time the last molek gets attached... or just simply wait x amount of seconds to pass from said timer without attach for another molek to spawn. (this second part seemed easy enough, but the first eludes me)

    Mind you, I had it working before, but when the center shape was built, the spawn-destroy cycle would continue in repeat until the next shape was called for, then act as normal.

  • I still don't understand how and when the molecules should spawn in your game, [...]

    Ah, I see. So when the last molek is collected, OR after a certain time passes without it being collected, when Chemic (the main sprite) isn't in miss mode, challenge mode, cutscene mode, or the shape in the center being built, as here for an example:

    That's when I want the moleks to spawn, one at a time. I did the second line so that very first statement can be applied, but wasn't aware it ran every tick.

    I have booleans and variables for all of these options.

  • This is what I have so far:

  • I still don't understand your question. But if you want to pause the function, then just don't call it. Check for some condition, say, use a variable - spawningIsPaused. Set it to true when you need to pause spawning.

    If NOT spawningIsPaused -> Call SpawnNewMolecule

    Then set it to false to resume spawning.

    This works only somewhat.

    Not entirely sure why, but I call the pause to happen in certain states and it doesn't function as intended. I think it may have to do with the fact that the Background sprite is the one with the timer and the instance variable of Pause, and I'm calling on booleans from other sprites to Pause, like so:

    Moleks still appear even after challenge is on, but only showing from one corner. I'd rather it didn't spawn at all, if not from the Chemic itself, which I've already done separately.

    If not, maybe I'm overlooking something crucial, because I also have a sequence of events happening here via function:

    * On function 'Cutscene'

    -> Background: Set Pause to True

    -> Chemic: Set 8Direction Disabled

    -> Plan: Set animation frame to 0

    -> Plan: Stop animation

    -> System: Wait 1.0 seconds (use time scale: True)

    -> Chemic: Subtract 1 from child_count

    -> Molek: Set attached to False

    -> Molek: Set Bullet speed to 500

    -> Molek: Set Bullet angle of motion to angle(0,0,Self.dx,Self.dy) degrees

    -> Molek: Set Bullet acceleration to 0

    -> Molek: Start animation from beginning

    -> Molek: Set collisions Disabled

    -> Chemic: Subtract 1 from child_count

    -> Molek: Set attached to False

    -> Molek: Set Bullet speed to 500

    -> Molek: Set Bullet angle of motion to angle(0,0,Self.dx,Self.dy) degrees

    -> Molek: Set Bullet acceleration to 0

    -> Molek: Start animation from beginning

    -> Molek: Set collisions Disabled

    -> Chemic: Subtract 1 from child_count

    -> Molek: Set attached to False

    -> Molek: Set Bullet speed to 500

    -> Molek: Set Bullet angle of motion to angle(0,0,Self.dx,Self.dy) degrees

    -> Molek: Set Bullet acceleration to 0

    -> Molek: Start animation from beginning

    -> Molek: Set collisions Disabled

    -> Chemic: Subtract 1 from child_count

    -> Molek: Set attached to False

    -> Molek: Set Bullet speed to 500

    -> Molek: Set Bullet angle of motion to angle(0,0,Self.dx,Self.dy) degrees

    -> Molek: Set Bullet acceleration to 0

    -> Molek: Start animation from beginning

    -> Molek: Set collisions Disabled

    -> Audio: Play "Cutscene" not looping from Sounds at 0 dB (stereo pan 0, tag "")

    -> System: Wait 1.0 seconds (use time scale: True)

    -> Chemic: MoveTo: Move to (540, 1290) (Direct)

    -> System: Wait 3 seconds (use time scale: True)

    -> Audio: Play "Start" not looping from Sounds at -10 dB (stereo pan 0, tag "")

    -> Background: Spawn Build on layer 6 (image point 0, create hierarchy: False, template: "")

    -> Build: Set position to (180.909, 747.765109)

    -> Build: Fade: start fade

    -> Plan: Start animation from beginning

    -> System: Wait 5.0 seconds (use time scale: True)

    -> System: Save game to slot "mysave"

    -> Chemic: Set 8Direction Enabled

    -> Chemic: Set Cutscene to False

    -> System: Wait 1.0 seconds (use time scale: True)

    -> Audio: Play "World1" looping from Music at -10 dB (stereo pan 0, tag "")

    -> Background: Set Pause to False

    As you can see, the Pause boolean is set to false at the very end, and yet the molek shows right when the "Build" text appears and not later.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What recurring function? Did you mean a recursive function, which calls itself? Or do you call the function in a loop?

    Please post a screenshot of your code.

    This was about the (SOLVED) sprite instance spawning I had asked about earlier, in which a regular timer called the function.

    construct.net/en/forum/construct-3/how-do-i-8/spawn-sprite-instances-185929

    However, I noticed that upon the shape being built, the moleks would loop spawning and then destroying themselves immediately after, which I think is being caused by this little snippet here:

    How would I make it so that that doesn't happen, instead pausing the spawning for a while and then resuming until the final shape is built? (which would be the third stage)

  • So I noticed a loop that happens because the recurring function doesn't end. How would I make the recurring loop essentially freeze so that this loop doesn't happen?

  • That's it! Works like a charm, thank you!

  • This seems to work perfectly, given the 5 second count.

    One more thing:

    So when the last molek is attached, I would hope for another to spawn. In other words, I suspect there to be an "OR" block used somewhere in the 5 second block but can't seem to figure out how to get it to spawn only once per attach.

    If 5 seconds have passed and the molek isn't attached, then another may spawn, but only up to 4 at a time.

  • I see you've put an example, which is helpful.

    I should have specified, however, some of the parameters I planned to have in place.

    So when the last instance of Molek is attached, or after a certain amount of time passed, I hoped to spawn another in the designated place, all dependent on what color the last one was and where it spawned, which, due to instance variables, are supposed to be one and the same.

    I say "supposed to be," because sometimes a Molek will spawn in the center of the stage, which isn't what I intended. How should I go about fixing that? And for the time factor?

    Thanks in advance!

  • The initial question was partially solved. However, one thing still remains:

    I'm trying to spawn the object instances in clockwise order with 1 being first, 2 second, so on and so forth. What I have for code so far is this:

    I know the second line is a repeat of the first, and is wrong, because after the first color shows, only the second color in line shows up afterwards, and what I would want is for all colors to show in sequence, regardless of the last one that shows/is attached to the main sprite (Chemic). What I had before was a "choose(1,2,3,4)," which wasn't what I was looking for, either.

    Any help, as always, is appreciated.