• Sunday , 29 March 2020

15- Making HTML5 Game: Polymorphism and Inheritance. Javascript Tutorial Guide

Code Canyon



Episode 15 about making a video game in HTML5. In this video, I cover polymorphism and inheritance which are important aspects of Object-Oriented Programming.

Last Episode: https://www.youtube.com/watch?v=zH9z7bs15qk
Next Episode: https://youtu.be/dpIADPTu820
First Episode: https://www.youtube.com/watch?v=XgK4YaMqQFg

If you have any question, feel free to post a comment below or send me a Youtube PM.

Start Code: http://pastebin.com/TA2zpf3p
End Code: http://pastebin.com/ajrr7Drq

Original source

3d Ocean

Related Posts

10 Comments

  1. Tygari
    June 10, 2019 at 06:53

    Your tutorials are nice, but I have noticed often you when you do the next episode you have altered the project in between times. I am having to find and fix errors from these differences to make it work as you show in a finnally.

  2. Argorate
    June 10, 2019 at 06:53

    why do you use ""self" var instead of use native this? and why never use "new" keyword and class concept for ur object?!

  3. coldgatorademan
    June 10, 2019 at 06:53

    Is this the type of thing you're trying to do? Because I am trying to apply this to Java :

    public class Entity {
    protected int m_x, m_spdX, m_y, m_spdY, m_width, m_height;
    public Entity(int x, int spdX, int y, int spdY, int width, int height){
    m_x = x;
    m_y = y;
    m_width = width;
    m_height = height;
    }

    public void update(){
    updatePosition();
    draw();
    }
    private void updatePosition(){

    }
    private void draw(){

    }
    }
    //Entity is the superclass
    public class Actor extends Entity {
    private int m_hp, m_atkSpd, m_atkCounter, m_aimAngle;
    public Actor(int x, int spdX, int y, int spdY, int width, int height, int hp, int atkSpd){
    super(x, spdX, y, spdY, width, height);
    m_hp = hp;
    m_atkSpd = atkspd;
    m_atkCounter = 0;
    m_aimAngle = 0;
    }

    public void update(){
    super.update();
    m_atkCounter += m_atkSpd;
    }

    private void updatePosition(){

    }
    }

  4. Starogre
    June 10, 2019 at 06:53

    i have an important question, hopefully +RainingChain can answer. do you start your new projects with this structure or do you start with the code you did in earlier tutorials? like if you were to program a game from scratch, how do you actually go about doing it in terms of code complexity? do you have actor and entity functions right off the bat or do you work towards that? i'm kind of confused as to how to go about making my own thing based on the tutorials.

  5. Florian Villa Garcia
    June 10, 2019 at 06:53

    You have to put testCollisionRectRect function inside Entity or will be any error if you do this?

  6. star gates
    June 10, 2019 at 06:53

    What does return self mean and can u call function with a variable?

  7. Yoni Silverman
    June 10, 2019 at 06:53

    all of these have been great. Keep on making them.

  8. ilikestripes400
    June 10, 2019 at 06:53

    Watched a ton of other channels trying to teach in many other programming languages, but this is by far the best I've yet come across. The flow in how you introduce new concepts is flawless and welcome, and the focus on optimization keeps even the programmer thinking "what can I do to make this even more concise?"

    Only issues I've had are having to rewind and pause quite a bit with your father fast pacing; it's fine for those that are more advanced, but beginners may need a bit of time or heads-up you're about to quickly change a bunch of things and that they should pause. By this point in the tutorials, they're probably well aware though and it's fine.

    Again, love these tutorials though. Keep it coming 😀

  9. Вадим Неделенко
    June 10, 2019 at 06:53

    I'm looking forward for the next lessons. Thank you very much! Your explanations of material is very easy to understand even for foreigners like me and that's pretty cool!:) Keep doing your things.

  10. Fred Gatti
    June 10, 2019 at 06:53

    There are some bugs in your code. It took me 1 hour to find out the problem, as the console displayed nothing. 

    Check the parameters you pass to "Actor" and "Entity" (in your video, 
    I don't doubt your programming skills 😉   )

Leave A Comment

You must be logged in to post a comment.