For You Construct Wizards :)-Infinite Runner!

  • Hey guys

    My question is, how do I randomize the blue block in a straight line.

    Meaning I want the blue block to be created at random speeds an at the same position that I have it..

    So sometimes 3 blue blocks will be created and sometimes 2, sometimes 1.Right now the block is being created at the same speed all the time -_- so as I said, how do I change that. I included the CAPX below

    Long Live the Forums

    Jason <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

    bit.ly/1DeMNTN

  • Is this what you were getting at?

    https://dl.dropboxusercontent.com/u/706 ... BLOCK.capx

    Hey briggybros, thanks for the reply and help <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /> But I didn't want the size of the sprite to change. What I want is the sprite to spawn at different amounts..meaning, sometimes It will spawn 1 sprite, and sometimes it will spawn 2 sprites and sometimes 3 sprites..Any help and wisdom will be greatly appreciated!

  • That is what is happening in my example

  • That is what is happening in my example

    Awesome work Sir I'm not afraid to admit I'm a total noob, do you have advice on how I can achieve this briggybros?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, so it currently looks like this:

    All you need to do is change it to this:

    where '10' is the number of pixels to separate the blocks by

  • Yeah, so it currently looks like this:

    All you need to do is change it to this:

    where '10' is the number of pixels to separate the blocks by [/quote > > Once again, thank you briggy Also where can I play your projects? you must have a few killer games!

  • Jophiel, sure, what's the problem? And I've only ever released one game and it was a quick thing I did when messing with C2 after a period a hiatus

  • Jophiel, sure, what's the problem? And I've only ever released one game and it was a quick thing I did when messing with C2 after a period a hiatus <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" />

    I see, yea life can get busy, my main passion is music too..anyways so! 1st prob.

    I want one of the blue blocks that spawns to randomly be replaced by a red block, and when you press space bar when the player is overlapping the red block(or on collision -_- not sure) then it kills the player, and restarts layout/global variables..I've added some extra stuff to the capx so you'll see <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

    prob2)So Right now its either 1,2 or 3 blocks that are spawning,and when a blue block is just going off the screen another block/blocks spawn, and that's all thanks to you <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" /> But I want to spawn more blocks progressively and more quickly..it just seems a bit boring that they keep spawning at the same speed all the time..

    Here is the new capx

    bit.ly/1DIZQyp

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

  • 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

    Jay

  • Here is an example with the changes I added:

    https://dl.dropboxusercontent.com/u/706 ... oject.capx

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

    Jason

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

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