Tunnel Run game in ~170 lines of pure JS

43 comments · 97% upvoted · source · other discussions

comments

Puzzled_Performance9

this is amazing. i am quite new to javascript and would love to see your code. possible?

Lordthom

Use the inspect tool and check the .js file? Should work! Can't confirm though as i'm currently on mobile

monica_b1998 [OP]

holy crap! i pasted the wrong link - sorry! the code with the explanation is here: https://slicker.me/javascript/tunnel/tunnel_run.htm

fresh5447

I didn't realize you could jump at first. I was like, just me or is this game freaking impossible?

monica_b1998 [OP]

Chuck Norris beat this game without jumping or moving left/right.

[deleted]

[removed]

monica_b1998 [OP]

thanks!

Lordthom

Yeah, with like 10 more lines of code you could make it very pretty!!

[deleted]

[deleted]

monica_b1998 [OP]

thanks for your feedback! in my opinion there is a lot of value in vanilla.js

masteryder

Shouldn't take many more lines to make it go infinite right ?

monica_b1998 [OP]

yes - the length of the tunnel is determined by the const maxrows in line 20. how do you ever win if the tunnel is infinite?

fmbucket

High scores and leaderboard?

monica_b1998 [OP]

great idea!

dsuttles24

Make it like that old ps2 game Jack 3 add a car component!!

monica_b1998 [OP]

how many lines do you think it would take? :)

tiny_smile_bot

:)

:)

Elgodmaster

Cool game

[deleted]

So game tells you "skip the black squares or you die". So you do for a while. Until all squares become black, you fall endlessly into the black void while the game is laughing at you and mockingly saying "you win, ahahaha, you win, you gullible asshole!"

I don't like this game. It's like life.

monica_b1998 [OP]

thank you for sharing. deep stuff!

[deleted]

[removed]

monica_b1998 [OP]

thanks, dude!

AesarPhreaking

Kinda shit, have you considered using more lines?

/s

butsandcats

Totally, it needs way more bloat.

AesarPhreaking

Step 1: npm install react Step 2: npm install angular Step 3: npm install vue.he Step 4: ? Step 5: Profit

sc2heros9

Knees weak arms are heavy, theirs vomit on my sweater already, code spaghetti!

[deleted]

[deleted]

monica_b1998 [OP]

i pasted the wrong link - sorry! the code with the explanation is here: https://slicker.me/javascript/tunnel/tunnel_run.htm

[deleted]

It's called a view-source URI. The JS wasn't minified so you can literally just view the source code of the webpage. Please actually make some attempt to find the source code before posting such a comment.

[deleted]

[deleted]

CaHeK_37ru

У меня всё работает у вас нет.?

fzammetti

Quite nice!

monica_b1998 [OP]

appreciate it!

[deleted]

I’ve played it in my iPhone yet, u cant jump with the button u just have to tap anywhere.

monica_b1998 [OP]

yes, the button bitmap is just for orientation. the code is triggered by just the x coordinate of the event

Enea_Silvio

Pretty game, why does it ended so fast ? I enjoyed myself

monica_b1998 [OP]

it got too difficult for me, but you can change the maxrows in line 20

[deleted]

Tapping on the controls (double tap) causes it to zoom-in for me, if there's any way to prevent that behavior.

Very cool, though. Keep iterating on it. Good job!

TheThingCreator

add some easing to the jump animation. it would go a long way. linear movement feels off

drink_with_me_to_day

Need more speed pedal

nickx360

Loved it :D

monica_b1998 [OP]

glad you enjoyed it!

CaHeK_37ru

Забавно)

monica_b1998 [OP]

Забавно

Спасибо