Speedy1SonicBoy's Recent Forum Activity

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

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

  • Try Construct 3

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

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

  • As the title suggests, how do I tween the speed of an animation to slow down over time? The idea is for said animation to slow down over a period of 10 sec, from 100% speed (60fps) to 0% upon an event happening. That is to say, it should be triggerable.

    Any help is, as ever, appreciated.

Speedy1SonicBoy's avatar

Speedy1SonicBoy

Member since 28 Sep, 2024

None one is following Speedy1SonicBoy yet!

Trophy Case

  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

3/44
How to earn trophies