0 Favourites

Problems with endless running game

  • I've been trying to figure out how I want to generate my terrain and make my guy run through it, and the first idea I had was the old Starship game method, which would be to have my guy run on the spot and have the terrain just move under him. This didn't work so well because I wouldn't find a good method to move the floor consistently in C2. It started generating gaps between my tiles.

    The second way was I had generated a static level, and have my guy run through it, when he reaches the end of the level, it teleports him back to the start and regenerates the level. The problem is, the game is a endless runner / shooter game, and having my platform character actually run, has affected the accuracy of my bullets because they shoot where it was a moment ago, and not relative to his running speed.

    How would you solve either of these problems? In theory? or example.

    Would be very appreciative of any help!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I would like to know about this as well. I'v been thinking of experimenting with endless runner genre myself

  • I would also like to know as well. I am currently using a method involving three sprites using the wrap and bullet behavior to make the ground look like it is moving backwards so the character looks like he is running forward however I know this method is probably bad but at the moment it works.

    i also did try some other methods however as the OP said it would often have gaps. :S

  • Can't you just give the bullet the speed & direction the player has at the moment of shooting and then adding the bullet's own speed & direction? So if you'd shoot the same direction as you were walking the bullet's speed would be the players speed + its own speed. It should be possible to calculate the bullet's speed & angle when the player shoots in a complete different direction using sin, cos and/or tan. I can help you with that if you'd like (if you didn't try this method before and you don't know whether it works, I'm not completely sure either ;) ).

    If that doesn't work out you could also consider making bullets which hit at the moment of shooting, so fast it can not be seen. You could use a thin rectangle for the bullet sprite, which will test for collisions with other objects as soon as is created (and after that it is immidiately destroyed).

    Edit: I created an example of my first mentioned solution:

    Download

    Note; Because I made the bullets so slow it might look a little weird, but this way the effect is seen best. If you have a question about it let me know ;)

  • Rory - someone left a link to an endless runner tutorial on a different program. i've been trying to recreate it in construct to use in my own game with different mechanics and also leave as an example file for anyone who wanted to learn from it - however i am suffering from the same problem.

    if made with dt it leaves tiny (dt spaced i assume) gaps in the floor tiles, i couldn't for the life of me figure out how to account for dt in all the equations

  • You can get rid of the gap in the tiles by "offsetting" them based on an integer variable rather than moving them individually by, say, 60*dt.

  • I had this problem and using integer variable didn't fix it for me. Use rex's MoveTo behaviour.. worked perfectly and got rid of the gaps. Plus it's framerate independent.

  • That doesn't fix the gap between the previous and newly generated parts of the level though, just individual tiles.

  • You mean, creating a new tile offscreen at the end of the last tile? If so, then yeah, that's where MoveTo worked for me.

    I was doing a slots game and needed each reel segment to be created before it came into sight. I had terrible gaps.. tried everything. Then thought I'd have a go with MoveTo and it worked perfectly! No more gaps ever. ;)

  • procrastinator Alright! Will check that out :) Thanks a billion.

    @Jasper - PERFECT! That's exactly what I wanted. Now that it's in plain sight I can't believe how simple the solution was, you're a genius man. Thanks :)

    Must say, it took a few days, but you guys solved all my problems at one go. Scirra must be proud of this community <img src="smileys/smiley1.gif" border="0" align="middle" />

  • procrastinator - are there any drawbacks to using user made plugins? (like do they not work in certain places, on mobile phones or web publishing for example)

  • here is a demo game i did for a endless runner. Just press the space bar to jump.

    Runner

  • rfisher - in your game you spawn falling down the first gap (firefox)

  • wretchedshark

    it should work now.

  • rfisher That doesn't really solve much for me, floating platforms is pretty easy to generate, my problem is having the platforms connect exactly one after another since my game doesn't have holes in the floor. Also, its not a run and jump game, it's a run and shoot game :)

    Thanks for the demo though!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread sticky
763 305,597
asikanddestroy's avatar
asikanddestroy
Unread hot topic
232 177,660
Tetriser's avatar
Tetriser
Unread hot topic
266 15,896
GameeApp's avatar
GameeApp