CMPT 166 Lecture Notes - Lecture 9: Global Variable, Local Variable, Ellipse
Document Summary
In these notes you will learn: how to make an object move by itself in a straight line at different speeds, how to increment numeric variables, the distinction between local variables and global variables. We"ve seen how to make things follow the mouse using the mousexand mousey variables, and so now lets turn to the topic of making things move on their own. The basic trick for making a 2-dimensional animated object move is to change it"s (x, y) location on each call to draw(). In this course we are not concerned with the actual physical equations that govern the movement of objects. As long as the movement looksgood enough, then we will leave it at that. This is a pretty common approach when you are making animations for simple video games, where how things look is often more important than accurately simulating the real world.