How To Create Your First Game - JavaScript

  Рет қаралды 129,285

Web Dev Simplified

Web Dev Simplified

Күн бұрын

The chrome dinosaur game is a pretty cool easter egg, but it is also a pretty easy first game dev project. In this video I show you the basics of how to get started with game dev in JavaScript as well as a bunch of tips to handle more advanced game dev concepts.
📚 Materials/References:
GitHub Code: github.com/WebDevSimplified/c...
JavaScript Modules Video: • JavaScript ES6 Modules
JavaScript Modules Article: blog.webdevsimplified.com/202...
JavaScript Data Attributes Article: blog.webdevsimplified.com/201...
🌎 Find Me Here:
My Blog: blog.webdevsimplified.com
My Courses: courses.webdevsimplified.com
Patreon: / webdevsimplified
Twitter: / devsimplified
Discord: / discord
GitHub: github.com/WebDevSimplified
CodePen: codepen.io/WebDevSimplified
⏱️ Timestamps:
00:00 - Introduction
00:30 - HTML
02:35 - CSS
08:00 - World Scaling
12:04 - Update Loop
16:10 - Ground JS
24:50 - Start/Stop Game Logic
29:15 - Dino JS
40:38 - Cactus JS
48:23 - Game Lose Logic
#GameDev #WDS #JavaScript

Пікірлер: 139
@Sockerrus
@Sockerrus 2 жыл бұрын
The if-statement in your update function helped me solve an issue I've been stuck on for sooo long! Thank you!
@jamiyana4969
@jamiyana4969 2 жыл бұрын
The way you program and the way you explain things is just PERFECT. Honestly, you are the only reason that I'm trying to learn to code at 3am. I'm trying to finish all the beginner projects before the next semester 😅. Thank you so much for making these wonderful tutorials ❤️
@ASTERisk44946
@ASTERisk44946 Жыл бұрын
4am here bro ikr
@wiktoraugustyniak5965
@wiktoraugustyniak5965 2 жыл бұрын
another great vid bro, i get solid fondamentals in CSS and HTML and im study JS atm and all these projects will help me build good portfolio with projects and understand JS in mor pleasure way, keep it going!
@melvinnuslahdtuah269
@melvinnuslahdtuah269 2 жыл бұрын
You are exceptional brother... Please keep doing and sharing more ideas like this for people like me who's just getting into programming... ❤️❤️
@makamaka487
@makamaka487 2 жыл бұрын
I was literally just wondering earlier today how to make a JavaScript game. Thanks for reading my mind Kyle haha
@pythonandroidappdev3040
@pythonandroidappdev3040 2 жыл бұрын
HI
@quickcodingtuts
@quickcodingtuts 2 жыл бұрын
Awesome. Now I can play this game even if I’m offline …wait
@IshanKesharwani
@IshanKesharwani 2 жыл бұрын
That escalated quickly 🤣🤣
@rightbackatcha22
@rightbackatcha22 Жыл бұрын
I had fun doing this! thank you! some concepts are still very advanced to me making it impossible to grasp, but i guess it's good that I'm getting used to write the code.
@Android-17
@Android-17 2 жыл бұрын
Thank you so much Kyle! Really appreciate your contents.
@agustinguerra1575
@agustinguerra1575 Жыл бұрын
bro this is amazing! you deserve all the good
@CallousCoder
@CallousCoder Жыл бұрын
I love his code style! Very few youngsters develop this cleanly. With nice small single purpose functions. He avoids if else (I hate that so much!) this is a guy you want to make your frontend. For sure!
@Starkiller2725
@Starkiller2725 11 ай бұрын
The best tutor on YT as always goes to you!
@almogattal9701
@almogattal9701 2 жыл бұрын
I love your videos and this channel. Please post more small games development in JavaScript
@GsusIsKing
@GsusIsKing 2 жыл бұрын
The code appears to no longer work unfortunately. Both my code checked over multiple times, as well as cloning the exact solution code straight from the GitHub repository linked in the description, both bring up a blank white screen upon opening a webpage. I have tried both Chrome as well as Edge and neither seem to work.
@Satishkumar-rx7oy
@Satishkumar-rx7oy 2 жыл бұрын
very nice sir, I learned some concepts which was thinking to learn from past. Thanks
@aaxen7255
@aaxen7255 Жыл бұрын
I've been doing your tutorials and they are excellent, the best out there for JS and CSS imho. But dayyum you were going fast on this one :)
@silver5866
@silver5866 Жыл бұрын
Yeah pretty fast. I’m restarting it so I can watch it at 0.75x speed. Lol This was SUPER helpful, love the video!
@anondolphin71
@anondolphin71 2 жыл бұрын
Hi Kyle, I'm an amateur self-taught developer (front end) and I've had countless breakdowns in my journey but your explanations make me feel a lot less stupid and give me more confidence to keep going :) thank you so much ! ❤️ I still remember the first video I ever watched was on memoization and I've never hit the subscribe button faster
@gunjanbhanarkar3291
@gunjanbhanarkar3291 2 жыл бұрын
Soooo awesome, salute to your work buddy
@TheFamilysam
@TheFamilysam 2 жыл бұрын
I made sure to watch the video first this time before attempting it myself. Hopefully I can keep up more this time around, thanks for the info, alot to digest but is definitely helpful. edit:It did not...
@mountaintraveller3764
@mountaintraveller3764 2 жыл бұрын
Very helpful video bro Love from India❤
@CrazyCodingChannel
@CrazyCodingChannel 2 жыл бұрын
Really interesting video, like man
@AS-me8zt
@AS-me8zt Ай бұрын
Honest Opinion as someone with little coding experience, there was parts where it felt very fast and was hard to keep up, take your time, there is a few errors not to any fault of him, DOUBLE CHECK!!! your values especially if you are using this more as a template for different variables and images but same concept as I did, I got stuck a couple times but the best thing was just walking myself back through the process and how it works, I feel satisfied in running into these roadblocks unintentionally because they allowed me to way better understand the code I was learning and how to develop a dubgging mindset, I wholeheartedly recommend developing this game with your favorite animal and a free template, it works!!! there is some comments that talk about issues but they are easily fixable as long as you revise and double check.
@AS-me8zt
@AS-me8zt Ай бұрын
Also Inspect is your best friend!!!
@moonyu189
@moonyu189 2 жыл бұрын
omg I'm just start learning js, thks your vid very much
@melzz
@melzz 2 жыл бұрын
I learn a lot of new thing in JavaScript 👍
@ow5909
@ow5909 2 жыл бұрын
Great content as always! Thanks! Btw do you have any plans of possibly publishing on something with Next.js?
@TR1ckY_TV
@TR1ckY_TV 2 жыл бұрын
Hype Hype Hype 🎶 more of these pls 🤩 and btw . . . . . . . you dropped this 👑 king 😉
@veeteeplays8742
@veeteeplays8742 2 жыл бұрын
I wish I could just take all your coding experience and knowledge and install it in my brain 😭
@tommyo2172
@tommyo2172 2 жыл бұрын
you can actually do that. His whole youtube channel is basically his brain knowledge. So if you understand all of his videos then you probably have similar knowledge
@sennaevil
@sennaevil Жыл бұрын
@@tommyo2172 Not exactly. There's muscle memory and things of that nature but he can definitely become better.
@alisafaa140
@alisafaa140 Жыл бұрын
npm i expirence
@lestath2345
@lestath2345 3 ай бұрын
pip3 install programming-knowledge
@BlackPowder-Michal
@BlackPowder-Michal 7 ай бұрын
Hi, great and complicated project (for me). I'm at the and of the ground section and ground moving is not working like in your video. Both ground png are moving at the same position so parto of time there is ground and part ot time there is no ground. I found and solve the problem. This variable: const groundElements = document.querySelectorAll("[data-ground]") gives NodeList instead of Array so the solve is : const groundElems = document.querySelectorAll('[data-ground]'); const groundElements =[...groundElems]
@thehangman1517
@thehangman1517 2 жыл бұрын
Shit brother, you make this look easy! :D Great share! Thanks a lot! I really learned alot here
@CallousCoder
@CallousCoder Жыл бұрын
I made this in assembly on the C64 last year. As a round up for my C64 assembly course. But I still need to film the explanation. I don’t code that live in assembly 😂 I made the ground random based on a charset. But this works too.
@aaaliii4u
@aaaliii4u 2 жыл бұрын
Thank you for the such a great tutorial, but I have a question: do we really need return in the if statement of update function?
@antonarbus
@antonarbus 2 жыл бұрын
even it looks easy under Kyle's hands, that's the most difficult thing i have seen so far!
@user-eu9rf4nt9c
@user-eu9rf4nt9c 4 ай бұрын
Nice job 👍❤️❤️
@rrbossman
@rrbossman 2 жыл бұрын
I've been using JS from the beginning. I watch you videos, not to learn programming, but to watch your teaching. You do a great job! I want to say that you should make sure to use triple =... the 'let' statement == null works, but real world you would get called out. It should be === undefined. Keep up the work
@kappidrums
@kappidrums 2 жыл бұрын
That's not exactly true since using two "=" will allow you to check for both undefined and null without having the problem of zeros or empty string breaking your conditions
@shivarapolu3180
@shivarapolu3180 2 жыл бұрын
If possible please make a video on what keyboard shortcuts/techniques you use repeatedly because I often notice that you are waayy faster
@RDdggrd
@RDdggrd 2 жыл бұрын
Hi , Few short cuts for VS code : .classname [TAB] for h2.classname TAB for #id_name TAB for p#id_name TAB for img TAB for
@howardcrosales4523
@howardcrosales4523 2 жыл бұрын
hey bro what about mobile because i doing it on my android phone any tips?? thnks also i dont have other devices only phone
@koo4838
@koo4838 2 жыл бұрын
it's a good video, thx bro
@bhumikdhandhukia4471
@bhumikdhandhukia4471 Жыл бұрын
For the world scaling part What is the difference between using postion : absolute margin: auto and your part ? It gives pretty good results
@masternobody1896
@masternobody1896 2 жыл бұрын
Thanks
@hamsithacs4091
@hamsithacs4091 2 жыл бұрын
hey kyle i saw your whatsapp clone video you mostly use functional component , so do you think functional component is better?
@asrafulislam5034
@asrafulislam5034 2 жыл бұрын
Take Love From #Bangladesh
@alibinnaseer
@alibinnaseer 8 ай бұрын
Completed It 🎉🎉
@babicunlo3638
@babicunlo3638 Жыл бұрын
took multiple notes, thanks. why check collision with all the cacti though? you can only collide with the left-most one (or two, worst-case scenario)
@CarlitoProductions
@CarlitoProductions 2 жыл бұрын
I was just wondering, why was direct DOM manipulation for the game chosen over using canvas api? I notice a lot of JS games use canvas, and curious about this approach.
@dawitdemissie4611
@dawitdemissie4611 2 жыл бұрын
Genius!!
@alice13eth
@alice13eth 9 ай бұрын
That was fun 🥰
@tobi807
@tobi807 2 жыл бұрын
I was just wondering: Did you do the game rescaling with js only on purpose? Because you could do the exact same thing with css only, right?
@mythm2063
@mythm2063 2 жыл бұрын
that triggered me as well
@s.k.609
@s.k.609 4 ай бұрын
yeah it was unnecessary
@nyonjeezeogar5374
@nyonjeezeogar5374 2 жыл бұрын
Kyle the 🐐
@badtwin82
@badtwin82 2 жыл бұрын
Please do me a favour for fonts: if you don't want to include any external source, at least use something like 'font: 1rem/1.2 system-ui' pro-tip: for things like align-itens: center; or justify-content: center; use aic/jcc => tab ;) and if you weren't aware of it: for setting a default value for a custom property, use something like var(--my-property, 1em)
@ErikBlomqvistSwe
@ErikBlomqvistSwe 2 жыл бұрын
What do you mean with the 'tab' part?
@badtwin82
@badtwin82 2 жыл бұрын
@@ErikBlomqvistSwe Write a CSS definition in VSCode and try it out ;)
@RDdggrd
@RDdggrd 2 жыл бұрын
@@ErikBlomqvistSwe Hi, it is a short cut in VS code. Type aic and then press Tab : vs code will add align-items: center; automatically.
@badtwin82
@badtwin82 2 жыл бұрын
@@RDdggrd thank you for the explanation, seems it helped other people to understand my answer better as well. @Erik Blomqvist sorry for the confusion
@RDdggrd
@RDdggrd 2 жыл бұрын
@@badtwin82 😊
@brownboyintokyo7368
@brownboyintokyo7368 2 жыл бұрын
I get what he is explaining but I do not possess the level and thinking process in order to building something like this efficiently! I have always found game logic confusing. Any suggestions for how to improve the thinking process and be able to make small games like this?
@musingepitaphy
@musingepitaphy 2 жыл бұрын
sorry, no advice. Just want to emphasize that sometimes he was taking a look toward another screen.
@shawnlee5956
@shawnlee5956 2 жыл бұрын
15:56 what cpu you using? im using i7 8565u get 16.6 avg... vs yours 6.9 avg feeling your cpu is must stronger than mine 2x
@WebDevSimplified
@WebDevSimplified 2 жыл бұрын
It is my monitor. I have a 144hz monitor. My Cpu is actually 2 years older than yours as I have an i7 6700k
@BhumikaRaut-xm2ud
@BhumikaRaut-xm2ud 6 ай бұрын
what to do if we want to redirect it to the game overpage or show pop up
@kishoreramesh8110
@kishoreramesh8110 2 жыл бұрын
🔥🔥🔥
@jacksonmain1743
@jacksonmain1743 2 жыл бұрын
Hi there, I was wondering if you could help me with some trouble I'm having with the ground code. No matter what I try, I can't get the ground to move. Is there anyway to fix this issue?
@chrisdragoi2547
@chrisdragoi2547 2 жыл бұрын
Hey! Did you find a solution ? I have the exact same problem here…
@sinnastyx
@sinnastyx Жыл бұрын
im working through this tutorial now and am having the same problem. did you find a solution?
@shwackthenoobsac
@shwackthenoobsac 2 жыл бұрын
In this game can't we omit the fourth requirement for overlap? When would the dino ever be underneath the cactus?
@RyanKane
@RyanKane Жыл бұрын
If you add a duck command and pterodactyls.
@rishabsharma5307
@rishabsharma5307 2 жыл бұрын
Make a video on complex database modelling in MongoDB like one-one, many-one, many-many
@josephwong2832
@josephwong2832 2 жыл бұрын
awesome
@raccoonchannelvn9863
@raccoonchannelvn9863 2 жыл бұрын
Cool😎
@abdorizak
@abdorizak 2 жыл бұрын
Why u didn't but the score center of page ?
@danielraducu9073
@danielraducu9073 2 жыл бұрын
You are a god among mortal men !
@danny4541
@danny4541 2 жыл бұрын
Hm.. Around @20:00 my code does not work anymore when the ground should start to move. I checked back and forth but it's no use. I can't find the problem 🤷‍♂️It's not even working if I copy all the code 😂However, was nice to learn at least sth.
@chrisdragoi2547
@chrisdragoi2547 2 жыл бұрын
Hey, did you find a solution ?
@ranaalfayz1431
@ranaalfayz1431 Жыл бұрын
@@chrisdragoi2547 sammmmee what did you do to make it work
@Vrum89
@Vrum89 Жыл бұрын
Why I can't to change the source file with "document.querySelectorAll('[data-dino]')" but I can (setting an a 'id' into tag) with "document.getElementById('imageid);" ? EDIT: NeverMind. I used QuerySelectorAll (to retrieve a List) and not QuerySelector (like in your tutorial 😅) BTW: Excellent Tutorial!!!! Thanks a lot!
@hemat297
@hemat297 Жыл бұрын
Some one please send me link or separate images are used in this project
@rahulpothula1902
@rahulpothula1902 2 жыл бұрын
Does these projects increase the value of our resume'??
@ervanaz4850
@ervanaz4850 2 жыл бұрын
How to add a code that writes ..blabla to the screen right after you lose the game every time?
@vinoth6255
@vinoth6255 2 жыл бұрын
One my office crush asking this, If you are too good at front end do this dinosaur jump game on your own.
@nahual69
@nahual69 2 жыл бұрын
How long did it take you to actually code this game?
@jboyle453519
@jboyle453519 2 жыл бұрын
im on like hour 10 lol
@wadihrizk
@wadihrizk 2 жыл бұрын
I believe that some people were born smarter than others.
@foochertyi3714
@foochertyi3714 2 жыл бұрын
How to fix CORS Errors in Javascript????? it keeps showing blocked by CORS policy
@three-two-onesas
@three-two-onesas Жыл бұрын
He has a video on that
@rashmigajananvernekar4692
@rashmigajananvernekar4692 Жыл бұрын
What are the steps for publishing these games?
@jcoucelanga4373
@jcoucelanga4373 2 жыл бұрын
we need rpg upgrades and stuff :D
@wamanimemaster2330
@wamanimemaster2330 2 жыл бұрын
please learn how to make 3d model with vertex array etc... without using any library or framework (three.js, etc...) or at least tell me is it possible and if not how three.js show 3d? 🙏🙏🙏🙏🙏🙏
@jajarobert6244
@jajarobert6244 Жыл бұрын
Why is this game not running in mobilephone despite changing event listener to touchstart
@three-two-onesas
@three-two-onesas Жыл бұрын
Because he didn’t implement that
@luanfigueiredo6156
@luanfigueiredo6156 2 жыл бұрын
hi , i dont understand wtat this " *:: before , *::after" mean, somebody can explain?
@BorisScotch
@BorisScotch 2 жыл бұрын
the * (star) means every element and the ::before and ::after refer to pseudoelements, very useful to set the box-sizing to border box on * (all the elements), all before pseudoelements and all after pseudoelements in every project (when you select all elements with the * pseudoelements are not included). In this particular case he is not using any after or before pseudoelements, but is a good practice nevertheless
@aliimranadil2
@aliimranadil2 2 жыл бұрын
How to start the game on mobile
@aaronparker8141
@aaronparker8141 4 ай бұрын
TimeStamp 29:52
@SteveosCPU
@SteveosCPU 2 жыл бұрын
Hi Kyle. I like your videos but "Web Dev Simplified "? I could write that game in a page of code albeit long lines of code. Why did you make it soooo complicated?
@EmperorBob
@EmperorBob 2 жыл бұрын
"page of code"?
@optional.
@optional. 2 жыл бұрын
You teach everything clearly but I hate my sleepy brain
@inopsek
@inopsek 2 жыл бұрын
People use canvas for gaming.
@MrJulito88
@MrJulito88 2 жыл бұрын
Top
@s.k.609
@s.k.609 4 ай бұрын
hey dude, This code is not working
@three-two-onesas
@three-two-onesas Жыл бұрын
Not exactly. There is an end screen if you stay in the game too long
@aidanbenbow6682
@aidanbenbow6682 2 жыл бұрын
At the beginning of the project, couldn't you just use a bootstrap container to achieve the desired scaling effect?
@tristanwait4itlegendary
@tristanwait4itlegendary Жыл бұрын
is it also Touch
@three-two-onesas
@three-two-onesas Жыл бұрын
No
@three-two-onesas
@three-two-onesas Жыл бұрын
Not exact. There is an end screen and clouds and sound effects.
@johannes1498
@johannes1498 Жыл бұрын
Just the update loop part could be already 50 minutes long, it doesn't make any sense in such a short time of explaining it
@bavongpaavong4998
@bavongpaavong4998 10 ай бұрын
I wantt those dino pic
@yuvansreesrigiri6135
@yuvansreesrigiri6135 2 жыл бұрын
I put the video in 2x playback speed to learn it twice as fast I am SPEED!!!
@ifecojahs8151
@ifecojahs8151 Жыл бұрын
I love your tutorials but this is so complicated
@three-two-onesas
@three-two-onesas Жыл бұрын
43:09
@satyasai69
@satyasai69 2 жыл бұрын
How to play in mobile
@three-two-onesas
@three-two-onesas Жыл бұрын
You cant
@user-ko2yo3zx8h
@user-ko2yo3zx8h 2 жыл бұрын
your audio has an issue
@pythonandroidappdev3040
@pythonandroidappdev3040 2 жыл бұрын
HI
@bradleyjoseph6678
@bradleyjoseph6678 Жыл бұрын
My Dino won’t jump
@itswilliboy7054
@itswilliboy7054 2 жыл бұрын
hi
@dagoshuaaaaaaaart
@dagoshuaaaaaaaart 2 жыл бұрын
Off
@yashvantvala519
@yashvantvala519 2 жыл бұрын
first
@7aidas7
@7aidas7 Жыл бұрын
Didn't learn anything. Too much code for simple game. Even after repeating code and game working.
@talhazaryab
@talhazaryab 2 жыл бұрын
Awesome. Now I can play this game even if I’m offline .... wait
@melodyparker3485
@melodyparker3485 2 жыл бұрын
Copy
@jeanrodrigues6249
@jeanrodrigues6249 2 жыл бұрын
Floppy
@malharsardeshmukh4057
@malharsardeshmukh4057 2 жыл бұрын
You make all the projects too complex.Please try to use simple javascript syntax which would be understood for us
@malemyengkhom56
@malemyengkhom56 2 жыл бұрын
Same here bro!! This video is really overwhelming 🥲
@three-two-onesas
@three-two-onesas Жыл бұрын
Guys just learn JavaScript
@three-two-onesas
@three-two-onesas Жыл бұрын
Not with khan academy though
@kaiumali9738
@kaiumali9738 2 жыл бұрын
Your pronunciation not clear. Speak slowly
How To Build JavaScript Projects Without Getting Stuck
32:57
Web Dev Simplified
Рет қаралды 70 М.
Beginner JavaScript Game Dev Project
39:14
Web Dev Simplified
Рет қаралды 113 М.
100❤️
00:19
Nonomen ノノメン
Рет қаралды 37 МЛН
ХОТЯ БЫ КИНОДА 2 - официальный фильм
1:35:34
ХОТЯ БЫ В КИНО
Рет қаралды 2,2 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 113 МЛН
Normal vs Smokers !! 😱😱😱
00:12
Tibo InShape
Рет қаралды 115 МЛН
Why your tech stack DOESN'T MATTER as a pro coder!
8:42
JavaScript Game Tutorial with HTML Canvas
27:45
Franks laboratory
Рет қаралды 72 М.
If You Want To Be An Advanced Game Developer Build This Project
59:54
Web Dev Simplified
Рет қаралды 146 М.
I Tried Making a 3D RPG Game in JavaScript
14:19
SimonDev
Рет қаралды 1,1 МЛН
This Simple Trick Makes Your Website 83% Better Looking
10:57
Web Dev Simplified
Рет қаралды 377 М.
6 Months of Learning JavaScript Game Dev in 6 Minutes
6:35
Suboptimal Engineer
Рет қаралды 111 М.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
developedbyed
Рет қаралды 889 М.
100❤️
00:19
Nonomen ノノメン
Рет қаралды 37 МЛН