JavaScript Game Tutorial - Advanced Techniques

preview_player
Показать описание
Make your own 2D adventures with HTML, CSS & plain vanilla JavaScript, no frameworks and no libraries! Today we will apply state design pattern, sprite animation, parallax backgrounds and we will learn how to control FPS with timestamps and delta time. Have fun! :)

❤ Related Links ❤
Download project sprite sheets:
Backgrounds:

⭐️Tutorial Contents ⭐️
00:00 Course overview & final project previews
00:29 Why to use State Design Pattern
00:57 State class
03:10 JavaScript state design pattern explained
12:51 Running state
13:46 Jumping state
15:23 Falling state
17:31 Sprite animation with vanilla JavaScript
18:32 How to control FPS in JavaScript game
24:28 Positioning the player in game world
25:35 Parallax backgrounds

Let's be friends

The description of this video may contain affiliate links, which means that if you buy one of the products that I recommend, I'll receive a small commission without any additional cost for you. This helps to support the channel and allows me to continue making videos like this. Thank you for the support!
#frankslaboratory
Рекомендации по теме
Комментарии
Автор

Hi Frank, I completed this part a few days ago...thank you!Very informative. I am HOOKED! 😀

PhorssaOneDev
Автор

Frank, love the code refinements, I always learn something new from your excellent tutorials. Thanks for sharing your knowledge!

carltone
Автор

A lot of great information, wonderfully explained with useful on screen notes to help with understanding - good job as always Frank! (:

phoenixxofficial
Автор

This is my next challenge. Bring it on!

javifontalva
Автор

This channel is a great find. Thank you for these excellent tutorials. Wishing you great success.

christopherc
Автор

Dude I started this series when I started learning js but i didnt understand anything now i am much advanced and I restarted this, dude the way you explain and the easy way you code i love that

techtime
Автор

Another masterpiece. Thanks Frank. Enjoy your weekend.

nicklansbury
Автор

This finally made Enums make so much sense to me. Thank you so very much!!!!

palmpixiplus
Автор

Thank you so much mate. I’ve been looking for a way to create this for months !!

TheLegendOfNiko
Автор

Just discovered the channel! It is amazing!I'm learning a lot! Thank you so much!

souerico
Автор

random small improvement I found: this movement code for the background causes a small stutter when we reset the image back to x=0, this is because the game speed pushes x by 3 and sometimes pushes x past the ultimate width, so when we get set back to 0 you can see the stutter, we also did not account for the gamespeed in this scenario.

To fix this, in the update method for Layer class, I instead increment x by the width of the background image, and I also subtract the game speed to keep moving seamlessly. code:

if (this.x < -this.width) this.x += this.width -

marcus_lyn
Автор

Loving this series so far, and indeed all your videos having recently discovered your channel. I'm a JS developer of business applications with some 15 years experience and it's nice to be able to follow along with your well-written and explained code to use my skills in a different way. Great job! +1 sub, +1 notification from me.

barryglibb
Автор

Tip: when using "Enum types" like states, you can use Objet.freeze to ensure the values doesn't change: like this: const states = Object.freeze({SITTING:0, RUNNING:1});

DannyHille
Автор

First, thanks for all the effort Frank

sertansantos
Автор

Nice video sir. Thank you for the tutorials.

Avinashkumar-zzqi
Автор

Hi Frank, I'm loving your tutorial and learning so much. You started mobile controls but how do you add different states on mobile.

scottatkinson
Автор

hi teacher, im doing same with you but my player not moving when he standing ?? maybe my chrome have problem??

dinhson
Автор

Thanks! I'll need to use that deltaTime technique at some point. Just one question: doesn't this make it refresh slower than the frameInterval? (because you use It would be nice to see a plot of the this.frameTimer values as they accumulate over time. I assume the average value to be something like (frameInterval+deltaTime)/2.

Radu
Автор

hello teacher, the tutorial was very good, the game is beautiful🧐

programer
Автор

Hi Frank,

Awesome course, i'm followig it and I'm enjoying it very much.

I just have one question, why do we need to set up a server? I've tried launching the game without the server, just opening the index.html file and it does not work. I'll thank you if you can clearify this.

aitorplaza
welcome to shbcf.ru