# Endless Driving (2D Sidescrolling Car)

**URL:** <https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999>\
**Category:** Examples & Tutorials\
**Created:** [January 15, 2024, 11:20pm UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999 "2024-01-15T23:20:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [January 15, 2024, 11:20pm UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/1 "2024-01-15T23:20:24Z")

</div>

> **[Flowlab.io - Endless Driving](https://flowlab.io/game/play/2191630)**
>
> \<p\>Drive over randomly generated terrain in an epic race against . . .\</p\> \<p\>. . . your device's computing power.\</p\> \</p\>So you can go for as long as you want, or as long as your device will allow before it lags out (Hint: the performance is...

[![](https://img.youtube.com/vi/Hn0Az3ML4DU/hqdefault.jpg "Endless Driving (Flowlab.io Game)") ](https://www.youtube.com/watch?v=Hn0Az3ML4DU)

I finally readjusted my sidescrolling car driving example to make use of the new Physics Joint behavior. The result has a bit less bouncy suspension than I would want, but it’s a tradeoff between that and having the wheels of the car able to fly all over the place upon colliding with the ground.  
The ground is randomly generated by spawning a combination of square and round blocks.  
Anyways, you can drive until your device is unable to run the game anymore due to there being too many ground objects spawned in (yes, they are disabled when offscreen and it still lags out eventually).

---

<div class="post-metadata">

**Author:** ![JUSTPLAINOP](https://community.flowlab.io/user_avatar/community.flowlab.io/justplainop/32/62091_2.png) [@JUSTPLAINOP](https://community.flowlab.io/u/JUSTPLAINOP)\
**Post date:** [January 16, 2024, 12:26am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/2 "2024-01-16T00:26:12Z")

</div>

… The player is always trying to flip backwards.

Other than that, I LOVE IT ALREADY!

---

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [January 16, 2024, 12:29am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/3 "2024-01-16T00:29:34Z")

</div>

Yeah, it’s supposed to make the car do a bit of a wheelie when you hold forward, but I may need to tone that down even more. Thanks for the feedback

---

<div class="post-metadata">

**Author:** ![JUSTPLAINOP](https://community.flowlab.io/user_avatar/community.flowlab.io/justplainop/32/62091_2.png) [@JUSTPLAINOP](https://community.flowlab.io/u/JUSTPLAINOP)\
**Post date:** [January 16, 2024, 12:31am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/4 "2024-01-16T00:31:39Z")

</div>

Try increasing the front wheel’s density, that might help.

Also, unless the car is rear-engine or a motorcycle, there isn’t much of a chance of doing a wheelie.

---

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [January 16, 2024, 12:36am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/5 "2024-01-16T00:36:23Z")

</div>

True, I only created that mechanic in the first place because without it, the game was way too easy.

---

<div class="post-metadata">

**Author:** ![JUSTPLAINOP](https://community.flowlab.io/user_avatar/community.flowlab.io/justplainop/32/62091_2.png) [@JUSTPLAINOP](https://community.flowlab.io/u/JUSTPLAINOP)\
**Post date:** [January 16, 2024, 12:36am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/6 "2024-01-16T00:36:45Z")

</div>

Oh, I guess. It’s still very fun though!

---

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [January 16, 2024, 12:39am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/7 "2024-01-16T00:39:02Z")

</div>

Thanks, and nice job getting the second place score!

---

<div class="post-metadata">

**Author:** ![JUSTPLAINOP](https://community.flowlab.io/user_avatar/community.flowlab.io/justplainop/32/62091_2.png) [@JUSTPLAINOP](https://community.flowlab.io/u/JUSTPLAINOP)\
**Post date:** [January 16, 2024, 1:00am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/8 "2024-01-16T01:00:51Z")

</div>

Thanks, but I don’t think 1st will last long.

---

<div class="post-metadata">

**Author:** ![JUSTPLAINOP](https://community.flowlab.io/user_avatar/community.flowlab.io/justplainop/32/62091_2.png) [@JUSTPLAINOP](https://community.flowlab.io/u/JUSTPLAINOP)\
**Post date:** [January 16, 2024, 5:01pm UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/9 "2024-01-16T17:01:14Z")

</div>

213,000.

---

<div class="post-metadata">

**Author:** ![117JOJO](https://community.flowlab.io/user_avatar/community.flowlab.io/117jojo/32/56510_2.png) [@117JOJO](https://community.flowlab.io/u/117JOJO)\
**Post date:** [January 16, 2024, 5:15pm UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/10 "2024-01-16T17:15:27Z")

</div>

I got 8th place GG

---

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [January 16, 2024, 7:26pm UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/11 "2024-01-16T19:26:09Z")

</div>

Wow, I couldn’t even get that far back before I added the tilting mechanic, nice job!

---

<div class="post-metadata">

**Author:** ![JUSTPLAINOP](https://community.flowlab.io/user_avatar/community.flowlab.io/justplainop/32/62091_2.png) [@JUSTPLAINOP](https://community.flowlab.io/u/JUSTPLAINOP)\
**Post date:** [January 17, 2024, 4:50pm UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/12 "2024-01-17T16:50:45Z")

</div>

I had to go on an average of 20 Speed. I tried “Flooring it”, and I only got to 30,000.

Then what do you know, Jake beat me.

---

<div class="post-metadata">

**Author:** ![Good\_Games](https://community.flowlab.io/user_avatar/community.flowlab.io/good_games/32/42721_2.png) [@Good\_Games](https://community.flowlab.io/u/Good_Games)\
**Post date:** [January 18, 2024, 6:05pm UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/13 "2024-01-18T18:05:03Z")

</div>

I thought I was going to get the to win, but then I realized that all the other players had a digt on top of mine. 😆

---

<div class="post-metadata">

**Author:** ![JUSTPLAINOP](https://community.flowlab.io/user_avatar/community.flowlab.io/justplainop/32/62091_2.png) [@JUSTPLAINOP](https://community.flowlab.io/u/JUSTPLAINOP)\
**Post date:** [January 18, 2024, 6:06pm UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/14 "2024-01-18T18:06:14Z")

</div>

Lol, welcome to my world.

---

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [January 18, 2024, 10:12pm UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/15 "2024-01-18T22:12:21Z")

</div>

![Difficulty in endless driving game](https://community.flowlab.io/uploads/default/original/3X/6/7/6776f0616fa65ed51e3194176b9dbad73b29d87a.png)  
These now exist

---

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [January 19, 2024, 5:06am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/16 "2024-01-19T05:06:20Z")

</div>

So now flipping gives you bonus points (though the system has some bugs and will occasionally think you flipped when you didn’t…but at least it works)

 ![Flips give you more points](https://community.flowlab.io/uploads/default/original/3X/7/2/72f8015a7d08046e74cbbc2c057a89a14b79cb09.png)  
The amount of points you get for a flip scales with the difficulty you chose (easy=fewer points, hard=more points).

Also, I implemented a collectible fuel mechanic, so you lose if you run out of fuel. This is so that there is more incentive to actually keep driving forwards over the terrain (and to prevent someone from just repeatedly flipping when they find a convenient area)

 ![Fuel Mechanic](https://community.flowlab.io/uploads/default/original/3X/1/4/1458fa02c53fa325fe479c3189d8d0236fdae76f.png)  
You burn more fuel on hard difficulty and less fuel on easy difficulty.

Anyways, besides fixing the flip bug, I don’t have any plans to add more stuff to this game, since after all, it’s just supposed to be an example of what’s possible in Flowlab now. So feel free to copy anything here and make your own game out of it.

---

<div class="post-metadata">

**Author:** ![Kasamir](https://community.flowlab.io/user_avatar/community.flowlab.io/kasamir/32/46922_2.png) [@Kasamir](https://community.flowlab.io/u/Kasamir)\
**Post date:** [January 19, 2024, 8:11am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/17 "2024-01-19T08:11:12Z")

</div>

what about adding airtime?

---

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [January 19, 2024, 8:40am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/18 "2024-01-19T08:40:49Z")

</div>

That’s a good idea; detecting if a wheel is touching the ground seems to be finnicky depending on how the car lands, but I’ll give it a shot…

---

<div class="post-metadata">

**Author:** ![Kasamir](https://community.flowlab.io/user_avatar/community.flowlab.io/kasamir/32/46922_2.png) [@Kasamir](https://community.flowlab.io/u/Kasamir)\
**Post date:** [January 19, 2024, 9:14am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/19 "2024-01-19T09:14:34Z")

</div>

You could use a proximity or two raycasts, one for each wheel?

---

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [January 19, 2024, 9:17am UTC](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999/20 "2024-01-19T09:17:43Z")

</div>

I’ve been using a Proximity, but if I make the check distance too short, it doesn’t always trigger when it should, and if it’s too long, then it starts becoming an inaccurate measurement of when the car is actually in the air.  
In other words, I’m trying to find the right balance.  
What did you have in mind with Raycast?

[Next page](https://community.flowlab.io/t/endless-driving-2d-sidescrolling-car/41999.md?page=2)
