# For You Construct Wizards :)-Infinite Runner!

Get help using Construct 2

### » Wed Apr 29, 2015 8:08 pm

briggybros wrote:@Jophiel, For problem 1, I would create a new frame to the block's animation which is a red version. Have the animation set to not play from the offset. When spawning the block, do block.setframe(round(random(1))). That will make half of the blocks blue and half of them red. Then add a block.oncollision(player) & system.comparevalues(block.animationframe = 1). Add the action: system.restartlayout.

For problem 2, you can use the variable 'time'. This is a number which represents how many seconds have passed since the game started. If you start straight into the game, then you can just use the variable. If you have menus etc, you will need to store the 'time' at the point the game starts, and then the time for the game is just time-gamestarttime. Then to make more blocks spawn over time, set the upper limit of the for loop to say, random(0,3)*floor(1 + time/25) So every 25 seconds the number of blocks spawned will have a larger probability to be more. To decrease the time between block spawns, the current method you are using is 'every x seconds' -> spawn some blocks. You have used x as a constant so blocks spawn at constant intervals. If you want to make it go faster over time, then you need to make x smaller over time. This could be achieved by having x = initialtime - time/10, so this way, every second the time taken for the blocks to spawn decreases by 0.1 of a second.

Hey Briggy, this is amazing , I have been trying months to figure this out, probably cause I am very new to the C2 scene in general..this is great! except there's only 1 thing, I don't know how to implement what you just told me loll..It would save me a year of trying to implement this if you were to help implement this into the capx for me briggy..I am sure you're a very busy guy so, whenever you can help that would be greatly appreciated, thanks for your help briggybros I have definitely learned some stuff here

Jay
B
8
S
2
Posts: 56
Reputation: 677

### » Thu Apr 30, 2015 12:39 am

Here is an example with the changes I added:
https://dl.dropboxusercontent.com/u/706 ... oject.capx
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

### » Tue May 05, 2015 9:37 am

briggybros wrote:@Jophiel, For problem 1, I would create a new frame to the block's animation which is a red version. Have the animation set to not play from the offset. When spawning the block, do block.setframe(round(random(1))). That will make half of the blocks blue and half of them red. Then add a block.oncollision(player) & system.comparevalues(block.animationframe = 1). Add the action: system.restartlayout.

For problem 2, you can use the variable 'time'. This is a number which represents how many seconds have passed since the game started. If you start straight into the game, then you can just use the variable. If you have menus etc, you will need to store the 'time' at the point the game starts, and then the time for the game is just time-gamestarttime. Then to make more blocks spawn over time, set the upper limit of the for loop to say, random(0,3)*floor(1 + time/25) So every 25 seconds the number of blocks spawned will have a larger probability to be more. To decrease the time between block spawns, the current method you are using is 'every x seconds' -> spawn some blocks. You have used x as a constant so blocks spawn at constant intervals. If you want to make it go faster over time, then you need to make x smaller over time. This could be achieved by having x = initialtime - time/10, so this way, every second the time taken for the blocks to spawn decreases by 0.1 of a second.

Briggy I friken love you man ahah.I appreciate this a ton..I finally see a light for my game and that it wont take years..I am sure this will be helpful to the forums as well.This is great but theres only one thing...im still a big noob and this is passing right over my head..I don't know how to implement this I know you're a busy guy,but if you have the time I would be very grateful if you can implement this into a capx for me so I can learn as well ?

Jason
B
8
S
2
Posts: 56
Reputation: 677

### » Tue May 05, 2015 3:00 pm

I think that you need to implement it yourself, that would help you more. I don't think me practically making the game for you will help at all. I will try to help you understand how things work, but I won't be making your game.
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Previous