This line of code is so easier to figure out when you know physics ->
var x = canvas.width/2;
var y = canvas.height - 30;
var dx = 2;
var dy = -2;
-//-
x += dx;
y += dy;
So knowing physics the x and y are positions, is that we commonly only need one position we are in the road and isn't important the distance from the floor because this distance will not change but in our example, we have variation in the vertical position, so
X and Y are distances and
dx and dy are displacements, and 'x + dx' or 'y + dy' is the actual position by the time. So if you don't know physics how you gonna knock till solve it. Rute Bezerra de Menezes Gondim
No comments:
Post a Comment