Help with creating an infinite driving game

0 favourites
  • 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi!

    You probably are familiar with the endless runner games, except when I take a look at the sample capx from Scirra, I notice that this game doesn't let you control your player. So it's using a set speed with a set obstacle speed.

    Now I'm wanting the player (car) to be able to drive left and right, finish a stage and then have another stage spawn after it.

    Problem is... I can't figure out how to adapt the endless runner sample nor am I able to get some of my ideas to work. Since the layout width isn't endless, I have to come up with something that will relocate the player back to a starting point when it reaches an end point:

    ------StartPoint---------------------------------EndPoint-------

    And I would set the sprite (ground/stage) to a new random frame so it will create a new stage. The car and ground both have physics. Problem with the relocate idea is that it didn't 'remember' the speed it had at the endpoint. Upon relocation it would simply start at 0 speed again, I could use a solution for that!

    Or if anyone has any other ideas to get this done efficiently. Basically the player can drive forwards and backwards. So I was thinking either I need to fix the relocation issue OR the ground would need to move in opposite direction when driving forwards or backwards. Now I tried and asked some stuff about that but couldn't get it to work without some weird occurences (like ground sprites miraculously falling from the sky at certain point).

    Anyway, I'd like to thank anyway who might be able to help.

    • R
  • Well... Based on the template:

    Change the player behaviour to 8Direction (Up and Down)

    Instead of:

    [quote:33gudoja]Car is on ground >>> Simulate pressing right

    you can use

    [quote:33gudoja]Every Tick >>> Car set vector X to 10

    so then you rearrange the obstacles, and make some events.

  • Yes, you need to make the ground move in the opposite direction to make it look as if the car is moving.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Tutorial:

    https://www.scirra.com/tutorials/4777/h ... und/page-1

    Forum post:

    viewtopic.php?t=63134&start=0

    This links will help you.

  • Physics objects are touchy about being moved with the set position action. It confuses the physics engine when things suddenly teleport.

    Anyways, I haven't done it in a bit but you should be able to keep the velocity by:

    1. save the the velocities to variables.

    2. move the object.

    3. wait a tick and set the velocities from the variables.

    Or just use the chipmunk behavior, it doesn't have that quirk. You can just simply move stuff without issue. Anyways either of those should fix the relocation issue.

    The objects raining from the sky is probably from them being launched there from off screen overlapping objects.

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