You make 2 variables called xvelocity and yvelocity. You then make the xvelocity and yvelocity increase or decrease when you press the arrow keys. Then you forever change y by yvelocity and x by xvelocity. This works because in real life, the position of an object changes by the velocity. You can also do this with acceleration by changing the xvelocity and yvelocity by a constant amount.
Comments
You need to be logged in to post comments
Add a Comment
awesome how do u make the box glide?
You make 2 variables called xvelocity and yvelocity. You then make the xvelocity and yvelocity increase or decrease when you press the arrow keys. Then you forever change y by yvelocity and x by xvelocity. This works because in real life, the position of an object changes by the velocity. You can also do this with acceleration by changing the xvelocity and yvelocity by a constant amount.
i can't tell you, it is to long. you need to download the project
(view all replies)