├── CNAME ├── logo.png ├── GitHub-Mark-32px.png ├── yt_icon_mono_dark.png ├── README.md ├── app.js ├── style.css └── index.html /CNAME: -------------------------------------------------------------------------------- 1 | www.aniakubow.com -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubowania/javascriptgames/HEAD/logo.png -------------------------------------------------------------------------------- /GitHub-Mark-32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubowania/javascriptgames/HEAD/GitHub-Mark-32px.png -------------------------------------------------------------------------------- /yt_icon_mono_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kubowania/javascriptgames/HEAD/yt_icon_mono_dark.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # javascript-games 2 | 3 | A simple one page site to host JavaScript Grid-based Game walkthroughs. 4 | 5 | www.aniakubow.com 6 | 7 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', () => { 2 | 3 | var buttons = document.querySelector('.paper-button') 4 | 5 | for (i = buttons.length - 1; i >= 0; i--) { 6 | var btn = buttons[i]; 7 | 8 | btn.addEventListener('click', function(e) { 9 | var bound = this.getBoundingClientRect(); 10 | var x = e.clientX - bound.left; 11 | var y = e.clientY - bound.top; 12 | var ripple = this.querySelector('.ripple'); 13 | 14 | ripple.style.left = `${x}px`; 15 | ripple.style.top = `${y}px`; 16 | 17 | animate({ 18 | timing: easeOut, 19 | duration: 500, 20 | draw: function(progress) { 21 | ripple.style.transform = `scale(${progress})`; 22 | ripple.style.opacity = 1 - progress; 23 | } 24 | }); 25 | }); 26 | } 27 | 28 | function animate({ timing, draw, duration }) { 29 | let start = performance.now(); 30 | 31 | requestAnimationFrame(function animation(time) { 32 | let timeFraction = (time - start) / duration; 33 | if (timeFraction > 1) timeFraction = 1; 34 | 35 | let progress = timing(timeFraction); 36 | draw(progress); 37 | 38 | if (timeFraction < 1) { 39 | requestAnimationFrame(animation); 40 | } 41 | }); 42 | } 43 | 44 | function bounce(timeFraction) { 45 | for (let a = 0, b = 1, result; 1; a += b, b /= 2) { 46 | if (timeFraction >= (7 - 4 * a) / 11) { 47 | return ( 48 | -Math.pow((11 - 6 * a - 11 * timeFraction) / 4, 2) + 49 | Math.pow(b, 2) 50 | ); 51 | } 52 | } 53 | } 54 | 55 | function quad(timeFraction) { 56 | return Math.pow(timeFraction, 2); 57 | } 58 | 59 | function easeOut(timeFraction) { 60 | return 1 - Math.pow(1 - timeFraction, 1.675); 61 | } 62 | 63 | function makeEaseOut(timing) { 64 | return function(timeFraction) { 65 | return 1 - timing(1 - timeFraction); 66 | }; 67 | } 68 | 69 | function makeEaseInOut(timing) { 70 | return function(timeFraction) { 71 | if (timeFraction < 0.5) return timing(2 * timeFraction) / 2; 72 | else return (2 - timing(2 * (1 - timeFraction))) / 2; 73 | }; 74 | } 75 | 76 | 77 | 78 | var TxtType = function(el, toRotate, period) { 79 | this.toRotate = toRotate; 80 | this.el = el; 81 | this.loopNum = 0; 82 | this.period = parseInt(period, 10) || 2000; 83 | this.txt = ''; 84 | this.tick(); 85 | this.isDeleting = false; 86 | }; 87 | 88 | TxtType.prototype.tick = function() { 89 | var i = this.loopNum % this.toRotate.length; 90 | var fullTxt = this.toRotate[i]; 91 | 92 | if (this.isDeleting) { 93 | this.txt = fullTxt.substring(0, this.txt.length - 1); 94 | } else { 95 | this.txt = fullTxt.substring(0, this.txt.length + 1); 96 | } 97 | 98 | this.el.innerHTML = ''+this.txt+''; 99 | 100 | var that = this; 101 | var delta = 200 - Math.random() * 100; 102 | 103 | if (this.isDeleting) { delta /= 2; } 104 | 105 | if (!this.isDeleting && this.txt === fullTxt) { 106 | delta = this.period; 107 | this.isDeleting = true; 108 | } else if (this.isDeleting && this.txt === '') { 109 | this.isDeleting = false; 110 | this.loopNum++; 111 | delta = 500; 112 | } 113 | 114 | setTimeout(function() { 115 | that.tick(); 116 | }, delta); 117 | }; 118 | 119 | window.onload = function() { 120 | var elements = document.getElementsByClassName('typewrite'); 121 | for (var i=0; i h1 { 184 | font-size: 40px; 185 | color: rgb(16, 61, 63); 186 | } 187 | 188 | .demo__title > p { 189 | font-size: 20px; 190 | color: rgb(150, 71, 71); 191 | } 192 | 193 | .demo__title > h1, .demo__title > p { 194 | margin: 0; 195 | padding: 0; 196 | } 197 | .demo_content { 198 | display: flex; 199 | justify-content: center; 200 | flex-wrap: wrap; 201 | } 202 | 203 | .block { 204 | display: block; 205 | padding: 20px 0; 206 | margin: 0 20px; 207 | text-align: center; 208 | } 209 | 210 | .block .block__title { 211 | font-size: 24px; 212 | letter-spacing: 1px; 213 | color: rgb(16, 61, 63); 214 | } 215 | 216 | .paper-button { 217 | position: relative; 218 | padding: 4px; 219 | width: 150px; 220 | height: 30px; 221 | margin-right: 3px; 222 | 223 | border-radius: 5px; 224 | overflow: hidden; 225 | user-select: none; 226 | border: none; 227 | text-transform: uppercase; 228 | font-family: inherit; 229 | font-size: 14px; 230 | letter-spacing: 1px; 231 | transition: background 0.3s; 232 | box-shadow: 0 2px 2px 0 rgb(0, 0, 0, 0.6); 233 | } 234 | 235 | .paper-button, .paper-button:active, .paper-button:focus { 236 | outline: 0; 237 | } 238 | 239 | .paper-button:hover { 240 | background-color: #EAEAEA; 241 | cursor: pointer; 242 | } 243 | 244 | .paper-button .ripple { 245 | position: absolute; 246 | width: calc(var(--button-width) * 2); 247 | height: calc(var(--button-width) * 2); 248 | left: 0; 249 | top: 0; 250 | 251 | border-radius: 50%; 252 | margin-left: calc(-1 * var(--button-width)); 253 | margin-top: calc(-1 * var(--button-width)); 254 | z-index: 9000; 255 | background-color: rgb(180, 180, 180); 256 | opacity: 0; 257 | } 258 | 259 | .paper-button.error{ 260 | background-color: rgb(238, 41, 41); 261 | } 262 | 263 | .paper-button.error:hover { 264 | background-color: rgb(230, 88, 88); 265 | } 266 | 267 | .paper-button.success { 268 | background-color: rgb(72, 69, 212); 269 | } 270 | .paper-button.success .ripple, .paper-button.error .ripple { 271 | background-color: rgb(200, 200, 200); 272 | } 273 | .paper-button.success:hover { 274 | background-color: rgb(84, 82, 218); 275 | } 276 | 277 | .paper-button.success, .paper-button.error { 278 | color: white; 279 | } 280 | 281 | 282 | .expandMoreContent{ 283 | height: 40px; 284 | overflow: hidden; 285 | transition: height 0.5s ease-in-out; 286 | position: relative; 287 | } 288 | 289 | .expandMoreContent.expand-active{ 290 | height: auto; 291 | transition: height 0.5s ease-in-out; 292 | } 293 | 294 | .expandMoreHolder{ 295 | padding:15px 0; 296 | text-align: center; 297 | } 298 | 299 | .btn-expand-more{ 300 | cursor:pointer; 301 | font-size:15px; 302 | color:#000; 303 | padding:5px 10px; 304 | line-height:1.2; 305 | border:1px solid rgba(0,0,0,0.2); 306 | display: inline-block; 307 | } 308 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Free JavaScript Tutorials 11 | 12 | 13 | 14 | 15 |
16 | 19 | 35 |
36 | 37 |
38 |

39 | 40 | 41 | 42 |

43 |
44 | 45 |
46 |
47 |
48 | 49 |
50 | 51 |
52 |
JAVASCRIPT
53 |
CSS
54 |
HTML
55 |
56 |
57 |
58 |

59 | Build your own version of Connect Four. 60 |
61 |
62 |

A retro grid-based game in vanilla JavaScript, HTML and CSS

63 |

In this repo, I will be putting extra focus on for loops. If you want to learn how to use for loops effectively, please have a look at my code.

64 |

What inbuilt functions are we going to focus on?

65 |
    66 |
  • for loops
  • 67 |
  • addEventListener
  • 68 |
  • setInterval
  • 69 |
  • document.querySelector
  • 70 |
  • arrow functions
  • 71 |
      72 |

      73 |
74 |
75 | Show More... 76 |
77 |
78 |
79 | 80 |
81 | 82 |
83 |
JAVASCRIPT
84 |
CSS
85 |
HTML
86 |
87 |
88 |
89 |

90 | Make Frogger in under 5 min. 91 |
92 |
93 |

A retro grid-based game in vanilla JavaScript, HTML and CSS

94 |

In this repo, I will be putting extra focus on the switch use case. If you want to learn how to use for loops effectively, please have a look at my code.

95 |

What inbuilt functions are we going to focus on?

96 |
    97 |
  • switch case
  • 98 |
  • addEventListener
  • 99 |
  • removeEventListener
  • 100 |
  • setInterval
  • 101 |
  • clearInterval
  • 102 |
      103 |

      104 |
105 |
106 | Show More... 107 |
108 |
109 |
110 | 111 |
112 | 113 |
114 |
JAVASCRIPT
115 |
CSS
116 |
HTML
117 |
118 |
119 |
120 |

121 | Super Simple Rock, Paper, Scissors 122 |
123 |
124 |

Build your very own game of Rock Paper Scissors in under 5 minutes with my tutorial. In this tutorial we will also by going over getElementById and querySelector.

125 |

What inbuilt functions are we going to focus on?

126 |
    127 |
  • deep equals
  • 128 |
  • if else statements
  • 129 |
  • removeEventListener
  • 130 |
  • getElementById
  • 131 |
  • && , ||
  • 132 |
      133 |

      134 |
135 |
136 | Show More... 137 |
138 |
139 |
140 | 141 |
142 | 143 |
144 |
JAVASCRIPT
145 |
CSS
146 |
HTML
147 |
148 |
149 |
150 |

151 | The ALTERNATIVE way to build Tetris 152 |
153 |
154 |

The easiest way to build Tetris for visual learners. A step by step guide to building your very own vanilla Tetris game in pure JavaScript, HTML and CSS.

155 |

What inbuilt functions are we going to focus on?

156 |
    157 |
  • forEach()
  • 158 |
  • querySelector
  • 159 |
  • querySelectorAll
  • 160 |
  • splice
  • 161 |
  • Array.from()
  • 162 |
  • Math.random
  • 163 |
  • Arrow functions
  • 164 |
      165 |

      166 |
167 |
168 | Show More... 169 |
170 |
171 |
172 | 173 |
174 | 175 |
176 |
JAVASCRIPT
177 |
CSS
178 |
HTML
179 |
180 |
181 |
182 |

183 | Make your own Whack-a-mole 184 |
185 |
186 |

Learn to make a simple grid-based game using HTML, CSS and JavaScript. The idea of whack-a-mole is simple! The player needs to hit the grid with the mole in as many times as possible until the time runs out. In this tutorial, we will cover:

187 |

What inbuilt functions are we going to focus on?

188 |
    189 |
  • forEach()
  • 190 |
  • querySelector
  • 191 |
  • querySelectorAll
  • 192 |
  • textContent
  • 193 |
  • setInterval
  • 194 |
  • addEventListener
  • 195 |
  • classList
  • 196 |
      197 |

      198 |
199 |
200 | Show More... 201 |
202 |
203 |
204 | 205 |
206 | 207 |
208 |
JAVASCRIPT
209 |
CSS
210 |
HTML
211 |
212 |
213 |
214 |

215 | Build NOKIA 3310 SNAKE!!!! 216 |
217 |
218 |

A vanilla JavaScript grid-based game | In this tutorial you will learn how to make a fully functional game of Nokia 3310 Snake. This is a total BEGINNERS introduction to JavaScript.

219 |

What inbuilt functions are we going to focus on?

220 |
    221 |
  • keyCode
  • 222 |
  • querySelector
  • 223 |
  • querySelectorAll
  • 224 |
  • passing through events
  • 225 |
  • setInterval
  • 226 |
  • addEventListener
  • 227 |
  • classList
  • 228 |
      229 |

      230 |
231 |
232 | Show More... 233 |
234 |
235 |
236 | 237 |
238 | 239 |
240 |
JAVASCRIPT
241 |
CSS
242 |
HTML
243 |
244 |
245 |
246 |

247 | Make a Count Down from scratch 248 |
249 |
250 |

Ever wanted to build your own countdown timer? It's going to take you under 5 minutes to have your very own timer in simple vanilla JavaScript, HTML and CSS.

251 |

What inbuilt functions are we going to focus on?

252 |
    253 |
  • setInterval
  • 254 |
  • addEventListener
  • 255 |
      256 |

      257 |
258 |
259 | Show More... 260 |
261 |
262 |
263 | 264 |
265 | 266 |
267 |
REACT
268 |
JAVASCRIPT
269 |
CSS
270 |
HTML
271 |
272 |
273 |
274 |

275 | Build a RANDOM BEER GENERATOR with useEffect 276 |
277 |
278 |

Get item from an API using React hooks - UseEffect

279 |

For this project, we will be using react hooks, mainly focusing on 'useEffect'. If you’re familiar with React class lifecycle methods, you can think of the 'useEffect' Hook as 'componentDidMount', 'componentDidUpdate', and 'componentWillUnmount' combined.

280 |

What inbuilt functions are we going to focus on?

281 |
    282 |
  • useEffect
  • 283 |
      284 |

      285 |
286 |
287 | Show More... 288 |
289 |
290 |
291 | 292 |
293 | 294 |
295 |
REACT
296 |
JAVASCRIPT
297 |
CSS
298 |
HTML
299 |
300 |
301 |
302 |

303 | Make an Increment me Counter using useState 304 |
305 |
306 |

This is a 7-minute tutorial to build an 'increment me' counter, that also prints a paragraph each time the counter is clicked.

307 |

In this tutorial, I am going to show you how to use the react hook useState to build a simple increment me counter. Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. I am also going to build this counter and then compare it to the old way of storing state in a class, just for those who are familiar with React already and would like to see how this has evolved.

308 |

What inbuilt functions are we going to focus on?

309 |
    310 |
  • useState
  • 311 |
      312 |

      313 |
314 |
315 | Show More... 316 |
317 |
318 |
319 | 320 |
321 | 322 |
323 |
REACT
324 |
JAVASCRIPT
325 |
CSS
326 |
HTML
327 |
328 |
329 |
330 |

331 | Setting up a project for React with Webpack 332 |
333 |
334 |

I'm going to show you how to set up your project to use react, and other JavaScript libraries. For this we are going to be using Webpack, a popular javascript module bundler, used to compile JavaScript modules.

335 |

I'm going to be teaching you from scratch. So if you have never touched React before, this is the dummy guide of how to.

336 |

What are we going to focus on?

337 |
    338 |
  • webPack
  • 339 |
      340 |

      341 |
342 |
343 | Show More... 344 |
345 |
346 |
347 | 348 | 349 | 350 | 351 | 352 |
353 |
354 |
355 |

YES THAT IS RIGHT. THESE

356 |

PROJECTS ARE FREE AND WILL

357 |

ALWAYS BE FREE! WHY?

358 |

Because the open source community helped me so much when I 359 | started learning JavaScript, I want to give something back! 360 | Yes, you can do katas, but its nice to build something tangible, something you can show to your friends that makes sense. So I bring you my JavaScript grid-based game tutorials!

361 |
362 |

WHO IS IT FOR?

363 |

The tutorials are for anyone who has done a few online CSS and HTML lessons and would like to incoporate some JavScript into real-life projects. I make each video from scratch, and leave the styling pretty shockingly bad for you to go wild on later.

364 |

365 |
366 |

367 | 368 | 369 |
370 |
371 |
372 | 373 | 377 | 378 | 379 | 380 | --------------------------------------------------------------------------------