0 Favourites

Auto Runner - Block

  • Hi guys,

    I'm currently trying to create my own game using the Auto Runner template. If you had a look at the template, you know that the block will move to the left (bullet behavior) and leave some space, then create another block with random width. Two blocks won't stick together, there will always be some gap between two blocks.

    My question is, I stopped the block from moving by using "Set Bullet Disabled" for 5 second, then it will resume moving to the left, then I notice, that the next block coming sticks with the previous block, so how could i stop all the blocks from moving when i use "Set Bullet Disabled"? Below is my capx file.

    Please help me, thanks!

  • Hi johnkx,

    Looking at the .capx file I can see that the following line is your problem:

    "Distance

    Every tick -> Add Block.Bullet.Speed * dt to CurrentDistance"

    When you are "pausing" the game by using "Set Bullet Disabled" for 5 seconds you are not stopping this counter from running. In fact, Block.Bullet.Speed is still constant as you are not changing that value, you are merely 'Disabling' the object's behaviour. This means that even though your blocks are disabled they are continuing to spawn.

    I resolved it by adding a global variable called "Pause" and used Boolean logic:

    "On "BGStop" -> Set Pause to 1"

    "On "BGStart" -> Set Pause to 0"

    "Distance

    Every tick

    Pause = 0 -> Add Block.Bullet.Speed * dt to CurrentDistance"

    By adding the condition "Pause = 0" your Distance logic will only run while the game isn't paused.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Lncredible Good job! You made my day, haha! Thanks alot!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)