All Pro Web Designs > > Learning Tutorials > Programming Languages > JavaScript > The Alternative Guide to Building Tetris with JavaScript – Video for The Ultra Beginner
The Alternative Guide to Building Tetris with JavaScript – Video for The Ultra Beginner
- January 19, 2024
- Posted by: MainInstructor
- Category: JavaScript
Video Title: The Alternative Guide to Building Tetris with JavaScript – Video for The Ultra Beginner
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
Ania Kubow
beginner tutorial for building tetris by ania
building tetris by ania
building tetris with javascript for beginner
code tetris game java by ania
coding tetris game by ania
create javascript games
create tetris game with javascript by ania
how to create tetris with javascript
how to make tetris in javascript
making tetris game with javascript
program for making tetris
tetris
tetris programming java source code
tetris theme
tetris using java by ania
Aww where is the space invaders videoooooooo
♥
RIP atom
Thanks a lot for this great video! Have been playing around and coding some stuff with p5.js before but coding Tetris just using "pure" JS is quite different. Will check out your 12hr+ Coding Bootcamp now 🙂
Good explanations.
Have you got a version using animationframe implemented so it runs at 60 fps
Great video, it took me a while to work out drawing the tetrimino rotations as the way it was described didn't make sense to how I understood it. None the less I worked through it and even with a different array I seemed to get the same result.
const lTetrimino = [
[1, 2, width+1, width*2+1],
[width, width+1, width+2, width*2+2],
[1, width+1, width*2+1, width*2],
[width, width*2, width*2+1, width*2+2]
]
I entered the solid blocks by row left to right then the next descending row. Rather than the column down procedure your purple coloured animation on the google sheet shown 🙂
Also I didn't understand why the width of 10 was used when the google sheet drawing, had 3×3 squares, but realised you're referring to the width of the game grid. And it made sense.
Can you please explain to me what you meant by "inline" when talking about the h3 tags at minute 17:00? Because as far as I know, h3 elements are block elements, and I even tested it to check it
Great tutorial Ania and explained in a simplified easy to understand way. Brilliant and thanks
Hi Ania, first if all thank you for all your information, video's and explenations! It's usefull and a lot if fun to watch and follow side by side your coding tutorial. I wonder if you know or maybe have a video where you can for example you highscore can be saved and showed om the webpage and other can try to brake that high score? A highscore scorebord
Hi Ania, I have to say this was by far one of the most useful tutorials for me to understand some of the basics of Javascript and I love the questions you give us to answer, they are really helpful. Thank you
Hey! You have a small bug. If you click the arrows and change the rotation, you can land inside an already fixed tetromino… Does anyone know how to fix it?
This is an excellent video! I have trouble learning Javascript because I wonder how I can practically apply it. This is a great example and makes coding fun! I get off of work in the evening and look forward to building my game. Thank you for taking the time to make this.
I have his a bit of a snag, and I'm surprised I made it this far before I ran into a problem. When I'm assigning a random shape to the mini grid (1:05 –
1:14), my tetrominos disappear completely. I think something I did with the freeze function where I start a new tetromino falling might be the issue, but the syntax looks identical to yours. When I inspect my code it says:
Uncaught SyntaxError: Unexpected token ')'…….in reference to the last line of my code. If you have any insight here I would greatly appreciate it! Everything was working fine up until this point. If you can't help, I'll just play around with it.
Also, do you go into ideas for customizing the styling of this game? I'm guessing I can find more detailed tetrominos, etc. online.
I'm subscribed and will be working on more of your projects! Thanks again!
prawie działa dobrze 🙂 błędy tylko przy obracaniu niektórych figur i jak chce się wcisnąć klocek w boczną lukę dziwne rzeczy się dzieją.
Can anyone explain the logic of the lTetrominoes and the widths? Why does 1, 11, 21 and 2 make that shape?
https://youtu.be/w1JJfK09ujQ?t=1358
try this pls:
const count = [1,2,3,4,5]
count[1]=17
console.log(count)
I am trying to read your finished code description in this video (https://www.youtube.com/watch?v=rAUn1Lom6dw), but I confused in these lines please can you help me with a figure that out.
squares[currentPosition + index].classList.add('block') ;
function freeze() {
// if block has settled
if (current.some(index => squares[currentPosition + index + width].classList.contains('block3') ||
squares[currentPosition + index + width].classList.contains('block2'))) {
// make it block2
current.forEach(index => squares[index + currentPosition].classList.add('block2'))
// start a new tetromino falling
random = nextRandom
nextRandom = Math.floor(Math.random() * theTetrominoes.length)
current = theTetrominoes[random][currentRotation]
currentPosition = 4
draw()
displayShape()
addScore()
gameOver()
}
}
What it means by block, block2 & block3 above lines. I can not figure the logic of these class names above with these classes in the CSS file.
Thank you Ania, this is really helping me with JavaScript fundamentals 🙂
In 32:47 you talk about the three parameteres of forEach but do not mention threreafter that you are just referring to the value parameter with your lambda construct. Or that you possibly will show how to use index and object later on in this project.
Hello and thank you for your great w3 tutorials. Here it seems to me that nowhrere you mention that somehow you access the grid in a kind of array way. I mean there does not seem a rows/collumns differentiation when it comes to the tetrominos and the grid .. or it is all inside the 'width-multipliers' used here and there. This does not seem an easily understandable way to use arrays. Or at least to mention it at some point and give a reference to something about it would be usefull. Best regards anyway.
Hi there, Ania. I'm having a hard time installing some packages on Atom. linter-eslint and language-babel. Tried to install them manually by searching on the Settings/Install in Atom and also tried to install through cmd by doing apm install linter-eslint and apm install language-babel. I hope I could send you the screenshot of the errors. I hope you can help me with this. I'm using windows 10 computer, too. Thanks.
think you forgot the bags and srs rotation system in tetris
Can you please explain this..
const lTetromino = [ [1, width+1, width*2+1, 2], [width, width+1, width+2, width*2+2], [1, width+1, width*2+1, width*2], [width, width*2, width*2+1, width*2+2] ]
I really like this tutorial. I'm having an issue though. When ever I am randomizing the Tetrominoes, it's doubling the pieces. They are on top of each other and it is completely changing its shape. is there any way to fix this?
Hey Ania, I noticed a bug, when you are at the right or left edge of the game, and you do rotate on some tetrominos, the tetrominoe pass the edge boundary and their cases go to another line…