Multi-room Platformer Game Tutorial with JavaScript and HTML Canvas

Поділитися
Вставка
  • Опубліковано 4 гру 2024

КОМЕНТАРІ • 155

  • @ChrisCourses
    @ChrisCourses  2 роки тому +38

    Big thanks to INTO THE AM for supporting the creation of this video. Help support them and get 10% off sitewide using intotheam.com/chriscourses

    • @ChrisCourses
      @ChrisCourses  Рік тому +9

      @@delanataylor people don't search for "I'm doing stuff and you just watch," they search for "tutorial." SEO matters in business, including UA-cam.

    • @Movies._.334
      @Movies._.334 7 місяців тому +3

      Hey I have a question I’m jumping way too fast and can’t figure out how to make it jump a bit slower
      Edit: nvm turned out I didn’t add a space😅

    • @taylormarie2009
      @taylormarie2009 6 місяців тому +1

      M

  • @tanjiroberto
    @tanjiroberto 5 місяців тому +27

    It’s simply magical, going to sleep watching a minecraft vid and waking up to this at 4:57 AM

  • @ella.is.innocent
    @ella.is.innocent 7 місяців тому +113

    all i did was fall asleep for 40 mins...

    • @fillippro0996
      @fillippro0996 7 місяців тому +4

      Yeah but I falled asleep for the whole video

    • @dragosludu3839
      @dragosludu3839 6 місяців тому +1

      Lmao frr

    • @Pyth0g
      @Pyth0g 6 місяців тому +2

      same lol

    • @perpetualsick
      @perpetualsick 5 місяців тому

      me too

    • @koi3824
      @koi3824 5 місяців тому +1

      I woke up to this playing lmao

  • @pandelismanikas5453
    @pandelismanikas5453 2 роки тому +5

    What I like the most is your code improvement over each game. Awesome staff!

  • @adamjankowski5755
    @adamjankowski5755 2 роки тому +6

    Hey I wanted to say that your tutorials are awesome. Structure of these videos is very cool for me because you divide it into sections - for example "Collision detection", "Collision blocks". I like to pause right after you end explaining what you are about to code and I code it in my own way. Thanks for beeing an inspirational creator. Have a good day and greetings from Poland.

  • @karanordberg2531
    @karanordberg2531 Рік тому +1

    great tutorial as a beginner I appreciate how you explain what you are doing and don't just code through as fast as you can, it is nice to see what is working and why something "breaks".

  • @sora1099
    @sora1099 2 роки тому +7

    This is gonna be the year I get into coding, and this channel is straight up gonna be the reason for it. Top notch content and all for free, much appreciated!

    • @kynshra8960
      @kynshra8960 Рік тому +3

      How did it go?

    • @sora1099
      @sora1099 Рік тому

      @@kynshra8960 its been a slow process but I've noticed some improvement in other areas, JavaScript aside, I can now work with config files and make super basic websites!

    • @giovannibandinelli9792
      @giovannibandinelli9792 Рік тому

      ​@@kynshra8960they died of ketamine overdose may them rest in peace

  • @Uncaught_in_promise
    @Uncaught_in_promise 2 роки тому +9

    I am totally jaw dropped. You are incredible in JS coding.

  • @testpurpose5845
    @testpurpose5845 Рік тому

    his voice is amazing and so is his concise and always clear way of explanation .

  • @dantedeluca2477
    @dantedeluca2477 Рік тому

    This is one of the best tutorials i've ever seen.

  • @Caiityko
    @Caiityko 2 місяці тому

    Wow! This is an amazing tutorial- this is the first time I've watched JavaScript and it actually CLICKED and became easier to understand. Thank you ❤

  • @dev-n-unix
    @dev-n-unix 2 роки тому +29

    Chris, I'd like to thank you for your awesome work. This is the best channel of 2022 I found this year. Top of the top.

  • @joaocesarlima7339
    @joaocesarlima7339 Рік тому +7

    Another amazing tutorial! Your pace and clarity are just incredible. Your latest videos totally deserve more views!

  • @AlKhafajiOne
    @AlKhafajiOne Місяць тому

    I like the object-oriented approach. Good stuff!

  • @Harsh-eo7xo
    @Harsh-eo7xo 2 роки тому +5

    Superb as always 👍

  • @brandonjacksoon
    @brandonjacksoon 2 роки тому +1

    Chris! Awesome course! Thanks for your knowledge and thanks for sharing this knowledge with us!

  • @sheepSheepStag
    @sheepSheepStag 2 місяці тому

    I managed to follow this tutorial to the end! Thanks for making it clear and easy to understand!

  • @limitedlifetime8443
    @limitedlifetime8443 2 роки тому +3

    I am a HTML5 JavaScript Game dev myself and I learned best way to make "dynamic sprite processing" from this great tutorial! Thanks and love 🙏

  • @MakeMultiplayerGames
    @MakeMultiplayerGames Рік тому

    Awesome! It feels like you've coded this exact thing maaany many times, because you do it flawlessly :)

  • @x_way4539
    @x_way4539 2 роки тому +1

    Very well done Chris

  • @eduardoduarte8773
    @eduardoduarte8773 2 роки тому +1

    Great content, chris, thank you very much!

  • @tproduction7761
    @tproduction7761 Рік тому

    THIS IS THE MOST USEFUL VIDEO I SEEN

  • @elvynmarte
    @elvynmarte 2 місяці тому

    Mr Chris, we love you man, thanks for this treasure

    • @ChrisCourses
      @ChrisCourses  2 місяці тому

      much love, thanks for watching 🙏

  • @k6y6l5e5
    @k6y6l5e5 9 місяців тому

    this tutorial was incredible, thank you!! I'm surprised at how well I was able to follow along and understand. However, I can never imagine being able to come up with how to do this on my own because it is SO complex lol.

    • @Movies._.334
      @Movies._.334 7 місяців тому

      Can u ask u smthn? Abt the tiles im not sure why it won’t show the same as how it shows on he’s end 57:21 If u know how to fix it pls lmk

  • @BeRaikwal
    @BeRaikwal 2 роки тому +1

    are u serious? THIS IS SOOOOOO COOOOLLLL BY FAR THE BESTTTT PROJECT U HAVE DONE SO FAR!!! In the start itself I can tell its gonna be a bit advance JS for a high-school student like me lmaoo but i will try my best to gain knowledge from this amazing tutorial!!!!

  • @Alstier
    @Alstier Рік тому

    Thank you for the video it's informative for someone like me who is basically a beginner! Very clear and easy to understand I like the step by step!

  • @dessasin4142
    @dessasin4142 2 роки тому +1

    The most fluent and understandable explanation I have ever watched, thank you very much.

  • @dev.yesworld
    @dev.yesworld Рік тому

    Thank you for the Tutorials!

  • @ej3fm494
    @ej3fm494 2 роки тому

    Love these videos definitely want to support you making more

  • @Juan_josed
    @Juan_josed 8 місяців тому +1

    Bro, muchas gracias de verdad !!!!

  • @sadrozzy
    @sadrozzy 2 роки тому

    Man, u r awesome. Keep doing what you're doing! And greetings from Belarus🎉

  • @dragoncode5072
    @dragoncode5072 2 роки тому

    You are the best. Thank you so much for this course !!

  • @JarbyStar
    @JarbyStar 5 місяців тому +2

    My subconscious is going to be such a good coder... To bad it can't just pass on all the information to me for when I finally arise from my slumber 😂

  • @David-And-A-Half
    @David-And-A-Half 2 роки тому +4

    The presentation on these videos really sets them apart from the average UA-cam programming tutorial. Clean quality audio recording and clear, well spoken instructions elevates the final product. Great job.

  • @creepychris420
    @creepychris420 2 роки тому +2

    this is a great tutorial. tyvm ✌I have been a web dev for 10 years but never fucked with canvas. you explain this so simply it should be pretty easy to get to grips with after this. implementing gravity like that reminds me of my first actionscript game. going to make something cool with this real soon lol. if i remember ill come back here and drop a link lol.

  • @eip408
    @eip408 Рік тому

    yow you are a genius, I've learned alot! Thanks man for giving valuable tutorials 🔥

  • @sosig556
    @sosig556 2 роки тому +1

    1:24:00 you can use 'every' method for this. It will stop iterating when falsy value is returned from callback

  • @noahr1545
    @noahr1545 2 роки тому

    Great tutorial as usual! You're awesome 😎

  • @areyoush
    @areyoush 2 роки тому

    OMG, it really worked. Thank you so much!!

  • @kennethsargent1092
    @kennethsargent1092 2 роки тому

    I’ve programmed with python and attempted swift. But the tutorials for swift were not great and I really struggled. I never thought I’d pickup html and js, but your videos showed up on my feed. I don’t think any previous channel I’ve followed has been able to show me so many important components of a language and also make it easy to understand! You’re killing it with these tutorials.

  • @DatConsole
    @DatConsole 2 роки тому

    You make the videos i need to improve my programming skills. Thank you so much for the effort that you put on this tutorials. A hidden gem indeed. 💎👑

  • @omerkaancoskun2620
    @omerkaancoskun2620 2 роки тому +6

    Thanks for all this content. Your tutorials are the best 🔥

  • @stefanbeyer7391
    @stefanbeyer7391 11 місяців тому

    Good Work, especially u explain every single step u are doin , abo, membership + Thumbs up

  • @Way_Of_The_Light
    @Way_Of_The_Light 2 роки тому +3

    Long time no see man. Very nice tutorial 😇🙏

  • @dj5cme
    @dj5cme 2 роки тому

    thank you straight to the point

  • @bhuvandwarasila
    @bhuvandwarasila 3 місяці тому

    Fire course bro!!

  • @lonewolfprogrammer8932
    @lonewolfprogrammer8932 Рік тому

    I found the kings and pigs tileset a couple weeks ago and really wanted to turn it into a game for a 16-bit console, but I couldn't get the damn tiles to fit together like yours and his preview images, and then I just stumbled across this video thumbnail like a sign from God.. AND YOU HAVE THE LEVEL PRE-MADE?! 😤

  • @denisshupenko1370
    @denisshupenko1370 2 роки тому

    That's great! Thank you so much!

  • @worldbest3097
    @worldbest3097 2 роки тому +1

    on the same era, with javascript game, there are no other contents like this bro! i already bought your subscription for 1year. make good contents more!!thx

    • @ChrisCourses
      @ChrisCourses  2 роки тому +1

      Thank you! Really appreciate that support on the yearly sub. Hope you've enjoyed some of the premium content over there, I finally have the rest of the Pacman course in the works 🥲

    • @worldbest3097
      @worldbest3097 2 роки тому

      great!!! ❤

  • @deepraj5778
    @deepraj5778 11 місяців тому

    Your channel is lit bro...

  • @madlink1650
    @madlink1650 2 роки тому

    this tutorial its awesome,
    thanks!!

  • @KiffinGish
    @KiffinGish 2 роки тому +3

    Great tutorial, thanks. I see that you have an aversion to semi-colons. I 'd recommend highly always using semi-colons. Avoids some potential nasty pitfalls later on.

  • @JlnTrog
    @JlnTrog Рік тому

    First thanks a lot for all those tutorials thay help me a lot !
    I just pointed an issue about player movement when we press multiple keys at the same time.
    Press RIGHT then LEFT then release LEFT lets you go right then left then right, no problems it works.
    Press LEFT then RIGHT, player keeps going to the left not reacting to the second press.
    To solve this issue I did 2 things :
    - In the event listeners, I toggle keys.X.pressed only if (!event.repeat).
    - In index.js I put a variable called lastDir. It's set to 'none' by default when player is not moving, to 'left' if only LEFT is pressed, to 'right' only if RIGHT is pressed. Then before checking if a sole key is pressed I check if both LEFT and RIGHT are pressed. If so I make player go the opposite direction told my lastDir + I don't update lastDir.
    Don't really know why it works but it does 😅

  • @sharmarahul384
    @sharmarahul384 2 роки тому

    My best developer uses my fav Javascript!

  • @snowflake8191
    @snowflake8191 Рік тому

    You are a miracle.

  • @oohsorry4506
    @oohsorry4506 Рік тому

    BRO U ARE SOO SMARTT

  • @luu_demencia999
    @luu_demencia999 6 місяців тому +4

    Damnnn
    Why do I always land on this video when I wake up??

  • @canluu592
    @canluu592 2 роки тому

    Tyy bang, sehat selalu!

  • @boynundakikoku3083
    @boynundakikoku3083 2 роки тому

    one and only easy and working method

  • @qianggao5760
    @qianggao5760 2 роки тому

    Chris, my superman🤣

  • @manukyanq
    @manukyanq 2 роки тому

    You are my hero ❤

  • @adamtak3128
    @adamtak3128 2 роки тому

    around 38:40 you can jump infinitely by just holding down the 'w' key

  • @zentheplayerrapper8504
    @zentheplayerrapper8504 Рік тому

    ;v esta muy bueno saludos bro 👍😎

  • @ibrahimgaming9972
    @ibrahimgaming9972 2 роки тому

    Thx bro,the best拾

  • @alwysrite
    @alwysrite 2 роки тому

    great teacher

  • @aylictal
    @aylictal Рік тому +1

    @Chris Courses Happy to see you using object literals for sprite swapping :) One last note: be careful of attaching functions to animation data (either named such as image() or your own custom anonymous functions (such as the GSAP stuff). Often times animation data is stored in json files, and json cannot have things like functions set to them in the json file itself. To get around that, you load the json in, then dynamically attach additional functionality to them after its loaded in, or just dont alter it at all (this helps a lot of you plan on saving animation data to a file for a save game feature). I hope that makes sense.
    Next up? Dynamically generated levels ala Binding of Isaac with maze like generation? Just an idea :) I learned quite a deal trying that out and could be an idea for you to try (google recursive backtracker) Cheers!

  • @temel_era
    @temel_era Рік тому +3

    Here's a little css to enhance the graphics a little bit:
    canvas {
    image-rendering: pixelated;
    }
    You can also want to center the game:
    body {
    background: black;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    }

    • @coversluisito4650
      @coversluisito4650 11 місяців тому

      Do you know the name of the program he uses at the end to add the doors?

  • @chetanuzumaki9581
    @chetanuzumaki9581 2 роки тому

    Thanks a lot 🛐

  • @Jerry-e7p
    @Jerry-e7p 2 роки тому

    thank you so much~~

  • @adelkhalifa1104
    @adelkhalifa1104 2 роки тому

    Thanks for your mind-blowing work, Chris! It would be an awesome idea if you recreate Icy Tower with javascript.

  • @bistbist1615
    @bistbist1615 Рік тому

    It is pretty good but it could hang for larger maps like in pokemon or metroidvenias instead you should use images and create a for loop for collisons with middle image it means you will need three images drawed on top of each other and need to check collision with middle image it can make game little blurry but it will make your game smooth fast and low on space

  • @learningXode-NG
    @learningXode-NG 2 роки тому

    Nice one

  • @VachNersesyan
    @VachNersesyan Рік тому

    GOD bless you

  • @surf2553
    @surf2553 2 роки тому

    NIIICE!

  • @learningXode-NG
    @learningXode-NG 2 роки тому

    Nice one :)

  • @ALGHOFAILY
    @ALGHOFAILY Рік тому

    Instead of using "event.key" at 35:00 , I think it is much better to use "event.code" Which is for w key case is KeyW. Key codes are global, no matter what language is your code it's gonna be the same. event.code are based on the physical key. So let's say by accident someone had caps lock on. the Eevent.key would be capital W, meanwhile we are listening for small w. the event.code gonna be the same.

    • @ClowdyHowdy
      @ClowdyHowdy Рік тому +1

      Great tip, I was wondering how to get around this. Thanks, it turned out great!

  • @home4you208
    @home4you208 2 роки тому

    u are a boss👍

  • @sebastianbrunobautes7145
    @sebastianbrunobautes7145 Рік тому

    you can make a walkthrough of platform game, NES style games, lode runner, nuts and milk, wrecking crew, etc. Where the game scenario is built dynamically by blocks

  • @romanalekseev5149
    @romanalekseev5149 2 роки тому

    Awesome)

  • @Izitnu
    @Izitnu 2 роки тому +1

    I am attempting to follow along but I do not want to use the "w" key to jump and instead want to use space. I figured out I could type case ' ': to simulate the space but when you enter the const, there are no single quotes. I am unsure of how to set the const to use the space key.

  • @ChrisCourses
    @ChrisCourses  2 роки тому +10

    Also if I forgot to upload any assets, just let me know here. Will be sure to add anything that's missing 👍

    • @Yusa_Beach
      @Yusa_Beach Рік тому

      Excuse me! I have a question, this was the very thing I was looking for, but I'm also wondering how you would be able to add a grid map?

    • @Ahmad-dd6fl
      @Ahmad-dd6fl 10 місяців тому +2

      what about the beautiful background music and sounds 😢

    • @requitudgilbert8723
      @requitudgilbert8723 2 місяці тому

      Thank you for the wonderful and educational video Chris i want to know if there is a resources that has a fight animation on kings and pigs and some other characters?

  • @GiveAcademy
    @GiveAcademy Рік тому

    Not hating… just curious…
    Why go through all the extra work to convert the collisions data into a 2d array? 2D Position in 1D array is y*width+x. I also wonder why it is necessary to create all of these collisionBlock objects? It seems 2 methods drawCollisionBlocks (would allow rendering the red boxes where they should be for debugging) and a quick lookup in the collision data to see if the value at the position of the current sprite location is 292 or not, would have taken much less work and created less overhead… so I’m curious as to weather this was necessary and why? Or what benefits come with doing it this way? My guess is that it is a style choice?

  • @Blitzz1510
    @Blitzz1510 Рік тому +1

    Hi what text editor do you use?

  • @rustymetalloid1016
    @rustymetalloid1016 7 місяців тому

    I'm still a little confused why you're using && operators for collisions around 1:27:09 . wouldn't that if statement only run if *all* sides are colliding at the same time? I see that it doesn't work that way, I'm curious why it works with && and not OR

    • @FaunFunc
      @FaunFunc 7 місяців тому

      It basically checks whether its colliding on both sides at the same time which cant be achieved using OR

  • @CorreQTCojo
    @CorreQTCojo Рік тому

    Great tutorial, I have few questions, how can multiple doors be applied into one level? and if I go to a previous level how can I spawn into a new position instead of the same position it was before in that level?

  • @biovawan
    @biovawan 2 роки тому

    Thank you for the Tutorials!
    Do you plan to make a game based on ECS, without using third-party libs?

  • @benjaminjohnson1761
    @benjaminjohnson1761 Рік тому

    Hey chris, quick question If I am building a game from one of your tutorials and I want to make the game a full stack development project', I was wondering if you have any tutorials on how to integrate something like node, or node.js into the project for lets say a sign in page, or like a statistical point tracker?

  • @DiegoWorlitz
    @DiegoWorlitz Рік тому

    Really appreciate your job here man. Could you be so kind in telling me the difference between coding this in JS and in Python Py game? Doing so, are both possible to create an .exe file to start the game or it would only run on a browser? Thank you and I wish you much success! Regards from Italy.

  • @blazingredlion6527
    @blazingredlion6527 2 роки тому

    hey, I am sorry , I am a newbie at web dev, can you tell me if this is a dynamic website ? I am making a project for uni, we have been assigned to make a dynamic website , I am assuming a video game would be pretty dynamic, right?

  • @SithStriker13579
    @SithStriker13579 10 місяців тому +1

    wat program were you using to type your code?

    • @Jcassss
      @Jcassss 8 місяців тому

      sublime text

  • @baileyerikadosh3132
    @baileyerikadosh3132 Рік тому

    I have a question, is Javascript and HTML canvas good for large scale indie games?

  • @831digital
    @831digital 2 роки тому

    How would you recommend turning something like this into a desktop game? Electron?

  • @ericsmith3589
    @ericsmith3589 2 роки тому +1

    Loving your tutorials - incredible stuff! Anyone know the following:
    How to make the player spawn on Level 3 to the idleLeft position instead of the default idleRight?
    How to solve the double jumping situation when holding down 'w'?
    Experimenting with both, but haven't quite got it working.

  • @kio6604
    @kio6604 3 місяці тому

    i woke up to this video LMAO

  • @akrit.ghimire
    @akrit.ghimire Рік тому

    Where do you get the soundtrack and sound effects from?

  • @raffone5486
    @raffone5486 2 роки тому

    AMESOME ! but how can you go back to the previous level ?

  • @Tony.Nguyen137
    @Tony.Nguyen137 2 роки тому

    All your courses on your website are free?! So what is the pricing for? Which course is a paid course???

  • @noahfeazell3336
    @noahfeazell3336 10 місяців тому

    How would I go about adding enemies to this? I tried so much but I couldn't implement anything with this system

  • @tak1zava_off
    @tak1zava_off 4 дні тому

    Where do you making maps?

  • @magma5956
    @magma5956 2 роки тому

    amazing!! how do i make the character have a swingable hammer??