Hi I looked for hours on this site and on internet in general how to move an object with html5/javascript and I founded a lot of answers but none of that answers was for me useful. I want to explain my problem: I just want to make move one of this two rectangles with the keyboard control but it's too difficult to me without help (I'm just 2 month learning javascript/css/html5). Please do not give a bad vote to that question, I want to help and to be helped on this site.
This is the code:
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="400" height="300" style="border:1px solid #c3c3c3;">
Your browser does not support the canvas element.
</canvas>
<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0,0,30,30);
var canvas1 = document.getElementById("myCanvas1");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(150,150,30,30);
</script>
</body>
</html>
Thanks guys, I want to learn here from Italy but there aren't the right schools/courses and I have to work hard on the internet to do that.