Remake RETRO Games with JavaScript

Поділитися
Вставка
  • Опубліковано 16 січ 2025

КОМЕНТАРІ • 198

  • @Frankslaboratory
    @Frankslaboratory  Рік тому +4

    Full EXTENDEd version includes: 4 unique enemy types, full source code from 8 stages throughout the project, 8 boss skins, super weapons and more. Check out the trailer and feature overview here: www.udemy.com/course/remake-retro-games-with-javascript/?referralCode=2ACCA21F16FE78E631F7

    • @karlkoch3345
      @karlkoch3345 Рік тому

      Got the extended version, wooo. Have you ever done any videos on 'ball games' or sports? like a player 1 passing a ball to a player 2? Thanks again for all your hard work! Great classes.

  • @Frankslaboratory
    @Frankslaboratory  Рік тому +16

    Pong (1972)
    Space Invaders (1978)
    Pac Man (1980)
    Donkey Kong (1981)
    Frogger (1981)
    What did I forget and which one should we remake next :D

    • @armatheos
      @armatheos Рік тому

      The Great Giana Sisters

    • @irfansaeedkhan7242
      @irfansaeedkhan7242 Рік тому +2

      mario :p

    • @philomath69
      @philomath69 Рік тому

      Can you make minecraft in 2d ( some intermediate or basic functions )

    • @HunorMartonBorbely
      @HunorMartonBorbely Рік тому

      Hey there :) Are you still on Twitter? I have a colaboration idea that we could do :)

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      @@armatheos First time seeing The Great Giana Sisters, looks like a fun game to remake from back in 1987

  • @DevBoy-hd4kr
    @DevBoy-hd4kr Рік тому +20

    Man you are genius, You won't believe the impact your videos made in my programming skills, you just took my programming skills and logical thinking to the next level, than you so much for these creative videos.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +2

      Thank you for letting me know you found some value. Congratulations on your progress!

  • @Matheus-cb9sy
    @Matheus-cb9sy 3 місяці тому

    Your passion is really inspiring, thank you for taking the time to make a video like this!

  • @alexeysokoloff7834
    @alexeysokoloff7834 Рік тому +2

    Hi, thank you for your channel. I used your features and made a portfolio. It allowed me to get a job as a frontend junior 2 years ago.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Hi Alexey, amazing, congratulation on your self taught success. It's good to share this so other people know it's possible for them as well. thank you

  • @michaelcheverie7579
    @michaelcheverie7579 Рік тому +2

    Thank you for another great video! I use these videos as "project" for my computer science explorations class I teach at my high school. My students follow your coding projects, and in the process, learn a lot about how to code! Thanks!

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Hi Michael. Amazing. Thank you for letting me know. Do you prefer smaller or bigger projects for your science explorations

    • @michaelcheverie7579
      @michaelcheverie7579 Рік тому

      @@Frankslaboratory Hi Frank! Thank you for asking! Both, actually. I have some students who like to dive into a long project, and others who prefer to do several of the smaller ones. What I teach is an "explorations" course, and so I am trying to expose my students to the things that can be done with coding. Many of the students are very interested in game creation, but I have others that are interested in music or ather coding applications. I also use some of the projects from the Coding With Radu channel, which I learned about through your videos. I'm very happy that your videos are available. They are an excellent resource for beginning coders!
      I am by no means a professional coder! Strictly amateur. However, I feel that with resources like yours, I can point my students in the right direction. I've had several during this past school year who said that they want to explore careers in computer science due to the experience they had in my classes.

    • @laptoprelaks
      @laptoprelaks 2 місяці тому

      his tutorial/course are good... the approach he teach is actually language agnostic... i was looking exactly for his kind of tutorial since a long time..unfortunately i think other than his video, we can only find the core teachings like this in old c++ books.... i didnt want to be stuck with using like contstruct or gamemaker... using his tutorial allow me to make games for some really niche platform like j2me using midletpascal

  • @Amar11115
    @Amar11115 Рік тому

    Thanks a bunch for making this video.
    I know for me it would take lot of time to grasp the concept here but I will do my best.
    Thanks a lot for providing resources as well.
    Have a great day!

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Hi Amar, it depends where you are in your JavaScript studies, it should be beginner friendly, if you know the basics of JS, good luck !

  • @franzgriffle6063
    @franzgriffle6063 7 місяців тому

    I made it through, and it works great. Thanks!

  • @M4rt1nX
    @M4rt1nX Рік тому

    Thanks for this one. It would be fun with different levels and if it gets announced on the screen when those starts. Then, the stronger wave of enemies could be released.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +2

      Yes. I like the idea. It has increasing wave size but proper levels with unique environments, enemy types or specific goals would be fun. I would probably use state design pattern for that

  • @granumuse7847
    @granumuse7847 Рік тому +1

    We are glad to have your guidance to retro games so far, Frank. Really thank you. Would you try to enter the 3D games also?

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Hi, I might do a 3D series eventually, I still want to cover a lot when it comes to 2D games. Going into 3D will require a lot more math.

  • @bennboi
    @bennboi Рік тому

    I definitely found some value in this great video. Thanks Frank 😊

  • @joaocesarlima7339
    @joaocesarlima7339 Рік тому

    Thanks for another excellent tutorial!

  • @ekvilibriumm4234
    @ekvilibriumm4234 Рік тому

    just found the channel today, omg im missing alot. Subscribed!

  • @dev1ce-wk3hg
    @dev1ce-wk3hg 9 місяців тому

    Thanks for the insightful video! I've learned a lot from it and can't wait to apply these tips.

  • @jiggity8289
    @jiggity8289 Рік тому

    you are the best man!! 👍 because of you I've understood so much more about this language!

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Thank you for letting me know. Glad you found some value!

  • @kennydelver4772
    @kennydelver4772 Рік тому

    Amazing work man !

  • @IrynaAbrosimova
    @IrynaAbrosimova Рік тому

    thank you. its super course

  • @IonizedSun
    @IonizedSun Рік тому +1

    Bubble Bobble (still love this game after all these years)
    International Karate

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Bubble Bobble is crazy. Took me a while to realise what's going on there. Fighting game like international karate would be fun to make. Great tips thank you

  • @yadday5153
    @yadday5153 11 місяців тому

    I made it till the end Frank. Thanks.

    • @Frankslaboratory
      @Frankslaboratory  11 місяців тому +1

      Nice work, well done on completing the project!

  • @vartikadehalvi7298
    @vartikadehalvi7298 10 місяців тому

    Couldn't believe I finally made a game! Thankyou. Please implement a feature where enemies can fire projectiles.

    • @vikramkanaujiya8662
      @vikramkanaujiya8662 10 місяців тому

      can i see your code ... im having an error in my code and i cannot find it ..... rechecking it with urs will be very helpful

  • @cristianrojas7155
    @cristianrojas7155 11 місяців тому

    thank you very much bro!!! although I don't understand English very well, I appreciate very much that you made this video, new sub.

    • @Frankslaboratory
      @Frankslaboratory  11 місяців тому

      Hi Cristian. Your English seems good. Hope you have fun with your coding projects

  • @AnimeThings_
    @AnimeThings_ Рік тому

    Waiting worth.... You are always awesome

  • @omergunay5635
    @omergunay5635 Рік тому

    another beautiful and impressive project :)

  • @JesusBecerra-c7h
    @JesusBecerra-c7h Рік тому

    @Franklaboratory looks great! Thanks for dropping such a gem on us, also love the tie. Reminds of me many of your previous video sprites used.

  • @melissaturk6052
    @melissaturk6052 Рік тому +1

    great content thank you sir!!!

  • @paulthomas1052
    @paulthomas1052 Рік тому

    Thanks for this video - extremely useful and a great game. I would like to see a 'Defender' or 'Skramble' style game in pure HTML, JS and CSS.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Hi Paul. Have you seen the Steampunk seahorse game I made here last year. The gameplay is very similar to Defender and Scramble. I guess it would be fun to make the art look closer to these original games. I will add it on my list thank you.

  • @steadywinsdesign
    @steadywinsdesign Рік тому

    Greetings. Do you create your own game art, Frank? Love the content. Thanks for sharing.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Hi Matt, I usually make rough sketches or find references online and one of my artists make it look professional, based on my brief. They give me high resolution photoshop and illustrator files and I process them into animated sprite sheets, depending on the needs of the project. That way I can create custom art assets that suit the project I'm working on and I have a lot of freedom in designing it, to make it look however I want.

  • @Mr123fairlane
    @Mr123fairlane Рік тому

    nice tie

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Its my gamedev tie. It helps me design my monsters 😅

  • @69zwaan
    @69zwaan Рік тому

    super awesome to see with useful code i need to learn how to use and i have a question you made a square foe code but if you look closely left or right hit with screen. you see move hit left or right. it is not right. can you edit "explain more"?

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Hi. I'm not sure I fully understand the question. Can you rephrase it please

    • @69zwaan
      @69zwaan Рік тому

      ​@@Frankslaboratory

    • @69zwaan
      @69zwaan Рік тому

      hello, well. you have to look closely at column from left start and end column rows. if you shoot at rows empty or right rows column shoot. see your column doesn't move right until end >width or

  • @Silas_standley
    @Silas_standley 5 місяців тому

    WHEN IT DOES WORK AS EXPECTED I THINK IT MAKES CODE MUCH MORE READABLE

  • @Stshq
    @Stshq Рік тому +1

    Pause button would be nice for my OCD 😆

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Good point, pause button would be pretty simple to implement here

  • @piersStreet
    @piersStreet Рік тому

    Frank where do you get your sprites??Do you make it or??

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      I make my own yes, since third party sites are unreliable and they have too many licensing conditions. I stopped using them and I always use my own art assets now.

  • @r.adicaL
    @r.adicaL Рік тому

    16:29 my bookmark for later

  • @medios_informaticos
    @medios_informaticos Рік тому

    Awesome!! Thanks

  • @javifontalva7752
    @javifontalva7752 Рік тому +1

    Can you add those article talking object pool? Ta muchly!

  • @stamatispap
    @stamatispap 5 місяців тому

    related to collision detection my bottom left rectangular isnt disappeared . why this happens?

  • @mesteif
    @mesteif Рік тому

    HI,
    Thanks for the great educational videos you make!
    i actually have an question. I wonder if it's possible to use custom bullets such png photo ?

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Hi. Yes bullets can be custom images just put that drawImage call inside draw method on Projectile class. The bullets can also be animated same as we animate other sprite sheets. I do that with flame projectiles in my older steampunk seahorse game tutorial

  • @anpapala5961
    @anpapala5961 Рік тому

    My favorite retro game is pacman and galaga awesome tutos when you goin to do pacman thank

  • @MadaraAzukar
    @MadaraAzukar Рік тому +1

    Good bro

  • @manuelnunez8239
    @manuelnunez8239 Рік тому

    can you make something on real data visualization using canvas html and JS including animation?

  • @ibilehenry
    @ibilehenry Місяць тому

    where can i get the images

  • @baxaweb
    @baxaweb Рік тому

    Thanks bro 👍

  • @webarrays
    @webarrays Рік тому

    can you make a series on 3d websites animation like good animations on youtube there is no content about 3d web animation for medium and pro level

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +2

      I'm not an expert. Will look into it. Ask Chris courses on his UA-cam he is a Three.js expert

    • @webarrays
      @webarrays Рік тому

      @@Frankslaboratory Thanks a lot for referring he is also a good guy with a lot of good details

  • @josephcieplak8920
    @josephcieplak8920 Рік тому

    Awesome!!

  • @piggymaster3209
    @piggymaster3209 Рік тому

    53:07

  • @yadday5153
    @yadday5153 Рік тому

    👍

  • @amidougansonre3074
    @amidougansonre3074 3 місяці тому

    After Collision detection , Player.shoot() did'nt word , I don't know its my browser or what , I used your source code but it's the same, I tried with Microsoft internet explore and Chrome , but same probleme... need help please !

  • @c__beck
    @c__beck Рік тому

    I'd love to see you do a video for mobile gaming using touch events instead of (or in addition to!) keyboard events.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Touch events as easy. Problem is calculating aspect ratio for different mobile screen sizes I guess. I will do some mobile tutorials soon

  • @AguVDev
    @AguVDev Рік тому

    👍!

  • @codingfetch5187
    @codingfetch5187 Рік тому

    Hey sir can you make a tutorial of drawing tool like figma from html canvas element? Thanks.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Yes I will do a tutorial for a simple drawing app. Need to check Figma will be probably much simpler than that because I try to keep most of my classes beginner friendly

  • @ranjeetkahar1536
    @ranjeetkahar1536 Рік тому

    Make a video on how you create images for the game. How to create game sprite in Adobe Photoshop, game character in Photoshop tutorial

  • @sokhaitrey9211
    @sokhaitrey9211 Рік тому

    Could u tell me about Math I should learn for build game? Thanks you

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Pythagoras theorem formula and maybe basics of trigonometry will cover you for A LOT of 2D games. It takes less math than people think,

    • @sokhaitrey9211
      @sokhaitrey9211 Рік тому

      @@Frankslaboratory Thanks you so much

  • @yadday5153
    @yadday5153 Рік тому

    Why is window.addEventListener('load') needed if the script tag comes just before the closing body tag?

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      It's because when you use a lot of dependant resources, you don't have a guarantee they will be loaded when the script file is executed. Especially here where we use a lot of sprite sheets. If that sprite sheet is not loaded when we use it in our JavaScript file, it will break the entire codebase. Try to host it online on a slow internet connection without the event listener and you will see.

    • @yadday5153
      @yadday5153 Рік тому

      @@Frankslaboratory Thank you Frank. I'm grateful!

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      @@yadday5153 I'm here to help 😊

    • @yadday5153
      @yadday5153 Рік тому

      Even on my private projects?

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      @@yadday5153 Usually just in relation to the code from my videos, it takes a while to get familiar with other peoples code, if I start debugging for everyone I will release even less videos :D

  • @irfansaeedkhan7242
    @irfansaeedkhan7242 Рік тому

    you are awesome

  • @tmbarral664
    @tmbarral664 10 місяців тому

    Frank,
    I'm a bit surprised you used an array for the keys. An object or a Map would be more appropriate here. Why an array ?

  • @nixoncode
    @nixoncode Рік тому

    👍

  • @king_lel_HD
    @king_lel_HD Рік тому

    👍

  • @hatimlokhandwala6312
    @hatimlokhandwala6312 Рік тому

    You are the best

  • @abdulrahmansmamman7538
    @abdulrahmansmamman7538 Рік тому

    Hi i am Abdul from nigeria , I love your game project , can you make a play list of super Mario , it will be interesting ,

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Hi Abdul, yes I will make something similar to Mario. Greetings to Nigeria

  • @GameMania-qv6nw
    @GameMania-qv6nw 10 місяців тому

    hello frank... you made awesome games and effect using simple interface to understand... i want a favor can you make rpg game that uses camera effect to follow player... can you make that game for me... Thanks

  • @9ernation4-life40
    @9ernation4-life40 Рік тому

    👍 player weapons please and boss enemies 👍

  • @64jcl
    @64jcl Рік тому

    It baffles me that your videos do not have more views or likes as they well made, contain well explained code and with nice assets that you even give away. I can assure others that if you want to start developing games, this is the way to do it. Do not use Unity or frameworks. Learn the basics, and you will see that what those engines do is practically what you are doing with simple classes to encapsulate features and once made you can reuse them over for different games too. Most frameworks require you to often learn some obscure scripting language, while here you can learn plain Javascript which is so much simpler imo.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Hi, thank you for your kind feedback. I agree, I think it's important to understand how the code works and 2D code is easy to write from scratch. For 3D projects Game Engines are more efficient probably. Also using JavaScript for games is a fun way to practice logical thinking and programming skills.

    • @64jcl
      @64jcl Рік тому +1

      ​@@Frankslaboratory , yes although today you can do pretty decent 3D games with WebGL as long as you are not aiming for an AAA look - but for simple platforming and stuff like this it works fine. Have you considered making a video about how you can package your Javascript games for distribution/installation? I have used NWJS for this which works great. Also a common problem with many 2D games like this is how you cater for different screen sizes and how to handle excess screen space. A lot of normal web pages even suffer greatly from not expecting superwide screens, and as a game designer you have to sort of design it to fit a minimum spec and figure out what to do with the excess space. It is no doubt best to decide on some resolution and just scale the canvas to max screen height but one should be careful then to avoid blurry pictures when everything is drawn using images. I often prefer deciding on some low end resolution then, like 854x480 (most have 16:9 screens today with 1920×1080 minimum) and use css image-rendering: pixelated; to retain the pixel look of the assets. A typical problem of many is that they mix resolutions of the assets too which looks quite ugly when they are all scaled differently, so better to draw/scale things in their correct size for the given resolution.

  • @technoinfoworldwide2329
    @technoinfoworldwide2329 Рік тому

    i tried this game to build by watching other youtube channel and in the middle part they didnt explain much and I left the video.Hopefully I can start this video and get more explanation(begineer friendly)...

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Let me know if you come across something that's not entirely clear. This is an east game to build if you know JavaScript

  • @johnniegilkerson4724
    @johnniegilkerson4724 8 місяців тому

    no sound?

  • @sodasoda-ml4iw
    @sodasoda-ml4iw Рік тому

    why subtitle can show sir

  • @Sangetsu04
    @Sangetsu04 10 місяців тому

    make castle adventure 🙂

  • @sodasoda-ml4iw
    @sodasoda-ml4iw Рік тому

    not understand ingglish sir i try indonesia subtitle but it not show in description

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Sorry about that. I wish there was a way to translate to all languages. Maybe UA-cam AI will do that eventually.

  • @Silas_standley
    @Silas_standley 5 місяців тому +1

    I LOVE OOP UNFORTUNATELY
    THIS COURSE IS WHERE I REALIZED
    CLASS IN JAVASCRIPT IS BROKEN !
    YOU CAN USE IT FOR BUILDING STATIC LIBRARIES BUT THINGS GET HAIRY WHEN YOU START TRYING TO USE IT FOR ENCAPSULATION
    METHODS GET PARALLELIZED POINTERS GET LOST STACKS OVERFLOW AND EVERYTHING COMES CRASHING DOWN
    PERHAPS IT WAS JUST MY EXPERIENCE MAYBE OTHERS DIDN’T RUN INTO THESE BUGS

  • @KuNhiRonaldo
    @KuNhiRonaldo Рік тому

    please give me source code ?

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      I will provide source code with the extended version as usual

    • @KuNhiRonaldo
      @KuNhiRonaldo Рік тому

      @@Frankslaboratory yeahh. I wait for you

  • @webarrays
    @webarrays Рік тому

    Thanks Alot for such great c0nntents

  • @javifontalva7752
    @javifontalva7752 Рік тому

    this.frameX ++
    this.frameX %= this.maxFrame
    This is simpler than using the if condition.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Hi Javi. Yes it's a nice trick. I should use it more often. I wonder which one is more performance friendly.

  • @yadday5153
    @yadday5153 Рік тому

    I'd like to see Stardew Valley!

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Yea, I will cover tilemaps. If I find a good pixel art artist I might try to do something similar to Stardew Valley. Probably will make the theme more scifi or fantasy.

    • @yadday5153
      @yadday5153 Рік тому

      @@Frankslaboratory Wow, than you

  • @Silas_standley
    @Silas_standley 5 місяців тому

    ALSO MICROSOFT SHOULD DISABLE THE BULB MINI MAP AND MDN REFERENCES BY DEFAULT

  • @andrzejgrabowski8750
    @andrzejgrabowski8750 Рік тому

    Moon Patrol (1982)

  • @JackxT-Q
    @JackxT-Q Рік тому +1

    not beginner friendly ,.he doesnt tell what ide/code editor he use and how to setup it,activate the console,.,.as an example, netbeans user may not use eclipse cuz this 2 editor/ide have different mechanisms unless they are teached or reading book, and tinker with themself(but quite risky),.But Judging By Gui Design It should Be Vscode.....But Yeah Still When I Run/Debug Just Blank/White Page Not Look Like You Have The Object Tables(Sorry For My Bad English Im From Asia)

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Hi. If you need my guidance on that, you are not ready for a project like this. Take some time with beginner JavaScript courses and after you learn the basics, then you can start with simple projects. Be patient. If it was so easy to learn coding, they wouldn't pay us good money for it 😅

    • @JackxT-Q
      @JackxT-Q Рік тому +1

      @@Frankslaboratory bruuuuhhhhh,.then how you activate the thing of element,console,recorder?(Idk What is it called)and what extension you use?

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      @user-su2ri5qv5u I use VS code editor with Live server plugin for instant reloads. The thing on the right is just Google Chrome browser with its usual console. None of this is mandatory you can use any web browser and any code editor to follow along

    • @JackxT-Q
      @JackxT-Q Рік тому

      @@Frankslaboratory Bruuuuuuhhhhh Alrigth Then it Seems Not My Destiny Become Game Dev isn't live server and open in browser the same? and yep.....,result same still only white page and no object visible...

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      @user-su2ri5qv5u its not the same. Some features of JavaScript work only when the code runs on a server such as export and import keywords. I didnt include any server specific code here. You can use console log to debug your problem easily. Things like this you learn in beginner JavaScript courses. I dont cover complete basics like that here.

  • @AnimeThings_
    @AnimeThings_ Рік тому

    Donkey kong

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +1

      Yes, I was watching the old gameplay of Donkey Kong and now I really want to try to code that :D

  • @sakshikumari3620
    @sakshikumari3620 Рік тому

    I am a beginner and this is quite hard for me understand.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      In the end of the day this is a complex animation project. I can imagine it's a challenge for a beginner. Keep learning and it will eventually become easy. Projects like this are suitable only after you finishwd multiple beginner courses covering the basics of JS

  • @botsjeh
    @botsjeh Рік тому

    FFS, just call restart() in the Game constructor

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      What do you mean

    • @botsjeh
      @botsjeh Рік тому

      @@Frankslaboratory In a lot of videos you initialize variables in the constructor and then later you copy half of the initializing code into a restart or reset method.
      Just call the restart/reset method in the constructor, avoiding duplicate code. Or make an init() method that you can call in ctor and in restart/reset.

  • @javifontalva7752
    @javifontalva7752 Рік тому

    I did this in update to check if the keys are in the keys array:
    if (this.keys.includes("ArrowLeft")) {
    this.speed = -4;
    }
    if (this.keys.includes("ArrowRight")) {
    this.speed = 4;
    }
    I guess it is the same but simpler.

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Hi Javi, yes 'includes' method can be used to replace 'indexOf', that's a good point!

  • @babicunlo3638
    @babicunlo3638 Рік тому

    thanks to you, i can now code simple games like this totally on my own. looking forward to seeing you cover more advanced topics like tweening / grid based movement / working with many tilesets and laying out multiple maps with them etc.
    but i'm still wondering why are you making a keys array and constantly modifying it upon every keydown event. why not just make it like this:
    //Game constructor
    this.keys = {
    "ArrowLeft": false,
    "ArrowRight": false,
    "1": false
    };
    window.addEventListener("keydown", ({ key }) => {
    if (key in this.keys) this.keys[key] = true;
    });
    window.addEventListener("keyup", ({ key }) => {
    if (key in this.keys) this.keys[key] = false;
    });
    //Player.update()
    if(this.game.keys["ArrowLeft"]) this.x -= this.speed
    ...
    wish you the best

    • @Frankslaboratory
      @Frankslaboratory  Рік тому +2

      Thank you for the tip, I like your technique. Will test it and might use it in the next video! I will probably cover scrolling tilemaps next if I can come up with a game that heavily relies on that. Probably some kind of simplified classic Pokemon game clone.

    • @babicunlo3638
      @babicunlo3638 Рік тому

      @@Frankslaboratory after testing, i found out that you can use dot instead of bracket notation if you don't use quotes in the keys object:
      this.keys = {
      ArrowLeft: false,
      ArrowRight: false,
      1: false
      };
      /*
      event listeners
      */
      //Player.update()
      if(this.game.keys.ArrowLeft) this.x -= this.speed

  • @javifontalva7752
    @javifontalva7752 Рік тому

    Instead of having the images loaded from index.html and hide in css and I just loaded from javascript like this.
    class Beetlemorph extends Enemy {
    constructor(game, positionX, positionY){
    super(game, positionX, positionY);
    this.img = new Image();
    this.img.src = this.img.src = "./img/beetlemorph.png";
    }
    }

    • @Frankslaboratory
      @Frankslaboratory  Рік тому

      Hi Javi. I think you would have to use a Promise for this to work. I have a feeling this code will fail if the image is large and hasn't loaded by the time JavaScript runs. I might be wrong. Will test it.