Game Development Reference
In-Depth Information
its default origin—(0, 0). One last thing to note about the origin is that it's part of the
Transformable class and so all of its derived classes have access to it.
As far as our animation goes, the process is quite simple. In every frame, we rotate the
square by 1.5 degrees and move it by 1 pixel to the right. By setting the framerate to 60
FPS, we can estimate that, after each second, the square will rotate by approximately 90
degrees (1.5 x 60) and move by 60 pixels to the right (1p x 60). However, performing the
game logic in such a way (relying on the framerate) is extremely unreliable and danger-
ous. We will explore how to manage time while performing animations and game logic in
Chapter 3 , Animating sprites .
Now, let's look at how we can control shapes in real time.
Search WWH ::




Custom Search