John_90 wrote:
Or do you have any other method to achieve it? To make the sprite to move forward smoothly? I really need help for this function to be working. Thank you.
Well, if you dare to leave the kindergarten of "sprites", the reminiscent of 1970x, the HTML5
Canvas
feature will allow you to play with much richer graphics models in absolutely smooth way.
It will take considerable effort, but what you can do is quite impressive:
http://net.tutsplus.com/articles/web-roundups/21-ridiculously-impressive-html5-canvas-experiments/[
^].
You can find several engines already designed, in particular, for creation of vector graphics, which can also be interactive:
Raphaël:
http://raphaeljs.com/[
^],
CAKE:
http://code.google.com/p/cakejs/[
^],
Paper.js, a vector-graphics scripting network:
http://paperjs.org/[
^],
Burst Engine:
https://github.com/rwaldron/burst-core[
^].
See also this Mozilla tutorial:
https://developer.mozilla.org/en-US/docs/Web/Guide/Graphics/Drawing_graphics_with_canvas?redirectlocale=en-US&redirectslug=HTML%2FCanvas%2FDrawing_Graphics_with_Canvas[
^].
—SA