For You Construct Wizards :)-Infinite Runner!

Get help using Construct 2

Post » Wed Apr 22, 2015 11:08 pm

Message: Jophiel can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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 :D

http://bit.ly/1DeMNTN
B
8
S
2
Posts: 56
Reputation: 677

Post » Thu Apr 23, 2015 8:04 pm

Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Thu Apr 23, 2015 11:45 pm

Message: Jophiel can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
briggybros wrote:Is this what you were getting at?
https://dl.dropboxusercontent.com/u/706 ... BLOCK.capx



Hey briggybros, thanks for the reply and help :) 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!
B
8
S
2
Posts: 56
Reputation: 677

Post » Sun Apr 26, 2015 11:01 am

That is what is happening in my example
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Mon Apr 27, 2015 5:43 am

briggybros wrote:That is what is happening in my example


Awesome work Sir :) what confused me is that the blue blocks are not separated meaning they are not spawning side by side with some space in between that separates them so it looks like just one block, so my apologies I should of made that a bit more clear :D I'm not afraid to admit I'm a total noob, do you have advice on how I can achieve this briggybros?
B
8
S
2
Posts: 56
Reputation: 677

Post » Mon Apr 27, 2015 8:54 pm

Yeah, so it currently looks like this:

Image

All you need to do is change it to this:

Image

where '10' is the number of pixels to separate the blocks by :)
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Tue Apr 28, 2015 8:05 am

[quote="briggybros"]Yeah, so it currently looks like this:

Image

All you need to do is change it to this:

Image

where '10' is the number of pixels to separate the blocks by :)[/quote

Once again, thank you briggy :) did you study at Harvard? ;) you have no clue how much this has helped me, I would have been trying to search for the answer months in ahah,its finally looking like I may get my project finished in this lifetime : :D I was wondering if you can help answer another question about the blue block for me, as it is another issue I have been trying to figure out for quite some time..but I'm guessing its easy for you :) Also where can I play your projects? you must have a few killer games!
B
8
S
2
Posts: 56
Reputation: 677

Post » Tue Apr 28, 2015 2:53 pm

@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 :P
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Tue Apr 28, 2015 11:57 pm

Message: Jophiel can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
briggybros wrote:@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 :P


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 :D

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 :D 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

http://bit.ly/1DIZQyp
B
8
S
2
Posts: 56
Reputation: 677

Post » Wed Apr 29, 2015 1:43 pm

@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.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Next

Return to How do I....?

Who is online

Users browsing this forum: ramyaswetha and 5 guests