How to Code a Tetris Game using HTML and javascript

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2020
  • Source code: jackhetech.io?p=tetris-js
    PLEASE NOTE: I made an update to the Rotate() function in the final source code that is not shown in the video to check if there will be a collision if the user tries to rotate a piece. Other than that, the code you'll be getting is the same as what's shown in the video.
    ► Follow me on Instagram: / jack_he_hd
    ► How I got an internship at Microsoft in 1st year university: www.youtube.com/watch?v=-7rJv...
    ► The book I am currently reading: amzn.to/2KsHeTq
    ► My low-budget camera: amzn.to/37PhFo9
    ###################################################################
    Major: Computer Science
    College: University of British Columbia
  • แนวปฏิบัติและการใช้ชีวิต

ความคิดเห็น • 19

  • @PedroTechnologies
    @PedroTechnologies 3 ปีที่แล้ว +5

    Awesome project!

  • @dheerajsharma1986
    @dheerajsharma1986 2 ปีที่แล้ว +2

    hey ! if we want to slide the pieces left or right when it touches the ground, how to do that ?

  • @duckyboy53
    @duckyboy53 2 ปีที่แล้ว

    do the shapes have to be done in any specific order? or can I do the slither shapes before the 2x2 square?

  • @brayanviera6132
    @brayanviera6132 2 ปีที่แล้ว +1

    no joke better than the real tetris

  • @alfa_0017
    @alfa_0017 5 หลายเดือนก่อน +1

    break a leg! you are the best

  • @computerlearningbyargusaca5217
    @computerlearningbyargusaca5217 3 ปีที่แล้ว +4

    🙏🙏Very nice .. 👍 thanks for the video 😍😍

    • @JackHeTech
      @JackHeTech  3 ปีที่แล้ว +1

      thanks for the support!

  • @nirmalapusparatna5169
    @nirmalapusparatna5169 2 ปีที่แล้ว

    Is it possible to add levels in the game?

  • @user-gl4bu1cr2y
    @user-gl4bu1cr2y 3 ปีที่แล้ว +10

    I started to learn Javascript recently and have a question in your code.
    let newGameState = () => {
    }
    To me, it seems like a mixture of variable(because of ‘let’) declaration and function. Any explanation will be helpful to my self-study. ^^;

    • @mido_plays6553
      @mido_plays6553 3 ปีที่แล้ว +7

      Its an arrow function look it up.

    • @Anime_Empire_2.0
      @Anime_Empire_2.0 2 ปีที่แล้ว +1

      its an arrow function and he used "let" because he wanted the newGameState to change , you only use const to store results that will not change and let when they will change such an score etc. have fun learning javascript !!

    • @juneru2
      @juneru2 ปีที่แล้ว +1

      I learned that () => { is basically the same as function() {, so it's just a built-in function stored in a variable

  • @vincentiusx3781
    @vincentiusx3781 ปีที่แล้ว

    i already follow your code. But, when i want to open html with live server it only show "Score: 0". and i try to use terminal and i follow your step and error. i still confuse how to run the program...

    • @phrandomcatvideos
      @phrandomcatvideos ปีที่แล้ว

      If you run the debugger, you might missed something around your constants.js file which is BLOCK_SIDE_WIDTH

  • @fsxaircanada01
    @fsxaircanada01 3 ปีที่แล้ว +5

    Speedrun time

    • @JackHeTech
      @JackHeTech  3 ปีที่แล้ว +4

      haha one day I will keep it under 5 minutes

  • @TonyStack
    @TonyStack 3 ปีที่แล้ว +2

    fIRST!

  • @brainbytes1794
    @brainbytes1794 ปีที่แล้ว

    huh