Hi everybody.
Can someone please explain to me a short example of how to move the screen in the X-axis on the canvas? - As this is a gaming platform.
I know how to move the image/object canvas, of course, with the help function setInterval() and var keyCode.
Example: I have a canvas object, where the width is 500, the height is 300, and for that I have a map generated at 2000px.
I created a form/image to move. I would like the arrow keys to move screen.
Code:function KeyDown(e) { switch(e.keyCode) { //left case 37: x_right -= 5; // instructions to move the screen... break; //right case 39: x_right += 5; // instructions to move the screen... break; } }


Reply With Quote
Bookmarks