Endless Runner help

Get help using Construct 2

Post » Fri Jun 22, 2012 8:48 am

Hi guys, Im really new to construct and html5 games (used unity, udk, gamebryo before) just doing some research into doing an endless runner type of game on C2 and been searching around for info but couldnt get an answer. I've used bullet to get movement on it but its going from left to right instead of right to left. How can i change its direction without changing the sprites visual rotation?

Also i've started looking into arrays - would this be a good start to getting random platforms generated (and if theres an example or tutorial that i missed that covers spawning random objects from arrays with attributes applied to them)? In addition to this, how would i spawn these platforms from outside the layout and be destroyed when the sprite completely leaves the layout?

any help would be much appreciated.
B
6
Posts: 30
Reputation: 1,260

Post » Fri Jun 22, 2012 6:24 pm

To get the bullet behavior to move from right to left change the bullet angle of motion by 180 degrees. I think there is an option to not rotate the object.

I posted a simple endless runner example awhile back asking for help with the jump. You may find it useful. I just move the scenery back to the other side when it goes off one end, but I wasn't trying to make varying platforms at the time.

Making player surge towards center of window

There is another example of a vertical scroller here:
Vertical scroll platform

As for using arrays, yes, that's the usual approach, however, since you can easily destroy the objects when they get to the other side of the layout, it isn't strictly necessary. You can create a loop to generate the various pieces of the platform with random properties and set it in motion a certain distance behind the last platform.

Maybe someone has an example using arrays.




B
29
S
11
G
12
Posts: 281
Reputation: 11,888

Post » Tue Jun 26, 2012 12:56 pm

Thanks Kittiewan, you were right about the bullet angle being set to off. managed to get them spawning from the right with the system event and create object every x seconds with the choose(value,value) - but it doesnt seem practical (or at the very least im probably not doing it right).

Tried looking into loops and its confusing me lol are there any example of loops being used to create/spawn random objects out there? (cos i cant seem to find any)

heres what i have so far (i have 3 platform sprites).
http://dl.dropbox.com/u/74839448/runner%20test_platforms.capx
B
6
Posts: 30
Reputation: 1,260

Post » Fri Jun 29, 2012 5:11 am

I'm planning to modify the bunny example I pointed you to. When a platform passes by a "gatekeeper" sprite it will trigger the creation of the next platform a random distance away. The platform will actually be created of random number of sprites, and at a varying height, and with random obstacles sprinkled over it. When the platform sprites and obstacles reach the other side of the layout, they'll pass by a "terminator" object and are destroyed.

That's my plan. I think it's pretty standard stuff, but I haven't had a chance to do it yet.

I modified your example along those lines (but simplified, of course.) One notable difference is that I put the different platform graphics in the same sprite, and then set the frame so I could easily generate random platforms.

runner test_platformsV2.capx

I hope it helps.

kittiewan2012-06-29 05:11:35
B
29
S
11
G
12
Posts: 281
Reputation: 11,888

Post » Sun Jul 01, 2012 6:34 am

Thanks heaps kittiewan! looking over your example now, so far been huge help.

I notice the jump propels you a certain distance ahead - is there a way to limit this distance?
B
6
Posts: 30
Reputation: 1,260

Post » Sun Jul 01, 2012 9:09 pm

The example I provided above just uses the standard platform jump, and it does move forward. That's why I was working on the bunny example.

In the bunny example, which was intended for use in an endless level game, the bunny appears to surge forward when jumping (correlated with the scenery speeding up), but then comes back to its original starting place, which is what a game like canabalt does. I don't recall all of the details at the moment, but I think you can adjust the amount of the surge by tweaking the vector x action.

To sum it up, for a good endless runner, I think you need to make use of techniques from both examples (or their equivalents.)
B
29
S
11
G
12
Posts: 281
Reputation: 11,888

Post » Tue Jul 03, 2012 12:57 pm

lots of thanks again with this, managed to fix it :)
B
6
Posts: 30
Reputation: 1,260

Post » Tue Jan 07, 2014 11:54 am

Hiya Kittiewan, nice example! I am specifically interested in hearing more about the random generation of platforms and the way gaps are specified to provide a 'fair' game. Currently I am writing a tutorial for educational purposes, where I try to explain every step of the process. So far I haven't seen many examples without code yet yours seems easy to explain to a class. However, how would you explain the whole "Create object" system action (gaps+width) to a noob-audience?
B
3
Posts: 7
Reputation: 189

Post » Wed Jan 08, 2014 1:33 am

Going to take a look at these later, but I would love to get some info on the putting obstacles on top of the platforms piece... I think I could modify that to allow me to specify a top layer (ground cover layer) in my platforms and also spawn random collectibles above the platforms and/or gaps to give them something other than just the survival aspect...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428


Return to How do I....?

Who is online

Users browsing this forum: makkancs and 28 guests