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




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


10 responses to “15- Making HTML5 Game: Polymorphism and Inheritance. Javascript Tutorial Guide”

  1. 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. 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(){

    }
    }

  3. 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.

  4. 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 😀

  5. 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 Reply