Please enable JavaScript to view the comments powered by Disqus.

Posts

  • Writing an easy-to-use vector library

    In this tutorial I will show you, how easy it is to write a small, but useful vector library in Javascript. The purpose is not to write a library that covers every little aspect or optimized to the extremes, but something which could be the base of a small game for example.

    // Making a vector object (x = 10, y = 20) by it's coordinates
    var v1 = new Vector(10, 20);    // (no new as you can see)
    // A vector with an angle of 90° and a length of 10
    var v2 = Vector.createPolar(Math.PI/2, 10);
    
    // Using the two will look like this:
    var v3 = v1.add(v2);      // Adding the two together
    v3.scale(v1.getLength()); // Scale the length of v3, with the length of v1
    // and so, on...

    More on that →
  • Making a Newtonian gravity game in Javascript

    Newtonian gravity is way cool. So, cool that I will show you how you can make your own HTML5 canvas game simulating gravity. Don’t worry it won’t be hard. I will write down every step which is needed for our game.

    More on that →

subscribe via RSS