{"id":760,"date":"2025-07-28T13:15:40","date_gmt":"2025-07-28T13:15:40","guid":{"rendered":"https:\/\/www.kevingordon.org.uk\/kevwp4\/?p=760"},"modified":"2025-07-28T14:01:57","modified_gmt":"2025-07-28T14:01:57","slug":"making-a-tetris-game-in-javascript","status":"publish","type":"post","link":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/","title":{"rendered":"Making a Tetris game in javascript"},"content":{"rendered":"<p>Making a Tetris game in Javascript can&#8217;t be too hard right? Right?<\/p>\n<p>I had a go years a go by following this brilliant tutorial here on YouTube:<\/p>\n<p><iframe loading=\"lazy\" title=\"Write a Tetris game in JavaScript\" width=\"1080\" height=\"608\" src=\"https:\/\/www.youtube.com\/embed\/H2aW5V46khA?feature=oembed\"  allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>Here is what this version looks like:<\/p>\n<p><a href=\"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2025\/07\/tetris-game.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-762\" src=\"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2025\/07\/tetris-game-264x300.png\" alt=\"\" width=\"264\" height=\"300\" \/><\/a><\/p>\n<p>You can have a go here:<\/p>\n<p><a href=\"https:\/\/www.kevingordon.org.uk\/projects\/tetris\/tetris.html\">https:\/\/www.kevingordon.org.uk\/projects\/tetris\/tetris.html<\/a><\/p>\n<p>You can see the source code here:<\/p>\n<p><a href=\"https:\/\/www.kevingordon.org.uk\/projects\/tetris\/tetris.js\">https:\/\/www.kevingordon.org.uk\/projects\/tetris\/tetris.js<\/a><\/p>\n<p>You are welcome!<\/p>\n<p>Please enjoy having a go or building it yourself.<\/p>\n<hr \/>\n<p>I have also created a version in Java previously, you can view the details here: <a href=\"https:\/\/www.kevingordon.org.uk\/kevwp4\/2022\/07\/09\/getting-a-java-applet-to-work\/\">https:\/\/www.kevingordon.org.uk\/kevwp4\/2022\/07\/09\/getting-a-java-applet-to-work\/<\/a><\/p>\n<p>And&#8230; there is a mobile friendly version with gamepad: <a href=\"https:\/\/www.kevingordon.org.uk\/projects\/tetris-mobile\/tetris.html\">https:\/\/www.kevingordon.org.uk\/projects\/tetris-mobile\/tetris.html<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I made a tetris game, again, this time in Javascript. By following an awesome YouTube tutorial I found, check it out!<\/p>\n","protected":false},"author":2,"featured_media":762,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[3,7],"tags":[31,24,30,9],"class_list":["post-760","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","category-tutorials","tag-cool","tag-tech","tag-tutorial","tag-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Making a Tetris game in javascript - Kev&#039;s Web<\/title>\n<meta name=\"description\" content=\"I made a tetris game, again, this time in Javascript. By following an awesome YouTube tutorial I found, check it out!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Making a Tetris game in javascript - Kev&#039;s Web\" \/>\n<meta property=\"og:description\" content=\"I made a tetris game, again, this time in Javascript. By following an awesome YouTube tutorial I found, check it out!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Kev&#039;s Web\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-28T13:15:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-28T14:01:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2025\/07\/tetris-game.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1778\" \/>\n\t<meta property=\"og:image:height\" content=\"2018\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kevin Gordon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@k_guk\" \/>\n<meta name=\"twitter:site\" content=\"@k_guk\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kevin Gordon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/\"},\"author\":{\"name\":\"Kevin Gordon\",\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/#\\\/schema\\\/person\\\/6f290d1865d91bf2ae6f6b460612b6fb\"},\"headline\":\"Making a Tetris game in javascript\",\"datePublished\":\"2025-07-28T13:15:40+00:00\",\"dateModified\":\"2025-07-28T14:01:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/\"},\"wordCount\":137,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/#\\\/schema\\\/person\\\/6f290d1865d91bf2ae6f6b460612b6fb\"},\"image\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/tetris-game.png\",\"keywords\":[\"cool\",\"tech\",\"tutorial\",\"tutorials\"],\"articleSection\":[\"Technology\",\"Tutorials\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/\",\"url\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/\",\"name\":\"Making a Tetris game in javascript - Kev&#039;s Web\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/tetris-game.png\",\"datePublished\":\"2025-07-28T13:15:40+00:00\",\"dateModified\":\"2025-07-28T14:01:57+00:00\",\"description\":\"I made a tetris game, again, this time in Javascript. By following an awesome YouTube tutorial I found, check it out!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/tetris-game.png\",\"contentUrl\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/tetris-game.png\",\"width\":1778,\"height\":2018},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/2025\\\/07\\\/28\\\/making-a-tetris-game-in-javascript\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Making a Tetris game in javascript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/#website\",\"url\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/\",\"name\":\"Kev&#039;s Web\",\"description\":\"Kevin Gordon&#039;s Blog\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/#\\\/schema\\\/person\\\/6f290d1865d91bf2ae6f6b460612b6fb\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/#\\\/schema\\\/person\\\/6f290d1865d91bf2ae6f6b460612b6fb\",\"name\":\"Kevin Gordon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/kev-pic.png\",\"url\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/kev-pic.png\",\"contentUrl\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/kev-pic.png\",\"width\":192,\"height\":213,\"caption\":\"Kevin Gordon\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.kevingordon.org.uk\\\/kevwp4\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/kev-pic.png\"},\"sameAs\":[\"http:\\\/\\\/www.kevingordon.org.uk\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Making a Tetris game in javascript - Kev&#039;s Web","description":"I made a tetris game, again, this time in Javascript. By following an awesome YouTube tutorial I found, check it out!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/","og_locale":"en_GB","og_type":"article","og_title":"Making a Tetris game in javascript - Kev&#039;s Web","og_description":"I made a tetris game, again, this time in Javascript. By following an awesome YouTube tutorial I found, check it out!","og_url":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/","og_site_name":"Kev&#039;s Web","article_published_time":"2025-07-28T13:15:40+00:00","article_modified_time":"2025-07-28T14:01:57+00:00","og_image":[{"width":1778,"height":2018,"url":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2025\/07\/tetris-game.png","type":"image\/png"}],"author":"Kevin Gordon","twitter_card":"summary_large_image","twitter_creator":"@k_guk","twitter_site":"@k_guk","twitter_misc":{"Written by":"Kevin Gordon","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/#article","isPartOf":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/"},"author":{"name":"Kevin Gordon","@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/#\/schema\/person\/6f290d1865d91bf2ae6f6b460612b6fb"},"headline":"Making a Tetris game in javascript","datePublished":"2025-07-28T13:15:40+00:00","dateModified":"2025-07-28T14:01:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/"},"wordCount":137,"commentCount":0,"publisher":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/#\/schema\/person\/6f290d1865d91bf2ae6f6b460612b6fb"},"image":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2025\/07\/tetris-game.png","keywords":["cool","tech","tutorial","tutorials"],"articleSection":["Technology","Tutorials"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/","url":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/","name":"Making a Tetris game in javascript - Kev&#039;s Web","isPartOf":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2025\/07\/tetris-game.png","datePublished":"2025-07-28T13:15:40+00:00","dateModified":"2025-07-28T14:01:57+00:00","description":"I made a tetris game, again, this time in Javascript. By following an awesome YouTube tutorial I found, check it out!","breadcrumb":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/#primaryimage","url":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2025\/07\/tetris-game.png","contentUrl":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2025\/07\/tetris-game.png","width":1778,"height":2018},{"@type":"BreadcrumbList","@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/2025\/07\/28\/making-a-tetris-game-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.kevingordon.org.uk\/kevwp4\/"},{"@type":"ListItem","position":2,"name":"Making a Tetris game in javascript"}]},{"@type":"WebSite","@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/#website","url":"https:\/\/www.kevingordon.org.uk\/kevwp4\/","name":"Kev&#039;s Web","description":"Kevin Gordon&#039;s Blog","publisher":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/#\/schema\/person\/6f290d1865d91bf2ae6f6b460612b6fb"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.kevingordon.org.uk\/kevwp4\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/#\/schema\/person\/6f290d1865d91bf2ae6f6b460612b6fb","name":"Kevin Gordon","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2016\/12\/kev-pic.png","url":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2016\/12\/kev-pic.png","contentUrl":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2016\/12\/kev-pic.png","width":192,"height":213,"caption":"Kevin Gordon"},"logo":{"@id":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-content\/uploads\/2016\/12\/kev-pic.png"},"sameAs":["http:\/\/www.kevingordon.org.uk"]}]}},"_links":{"self":[{"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/posts\/760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/comments?post=760"}],"version-history":[{"count":3,"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/posts\/760\/revisions"}],"predecessor-version":[{"id":764,"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/posts\/760\/revisions\/764"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/media\/762"}],"wp:attachment":[{"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/media?parent=760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/categories?post=760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kevingordon.org.uk\/kevwp4\/wp-json\/wp\/v2\/tags?post=760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}