You may be thinking that something's wrong with your automated sprites. You
remember adding code to make them move on their own, yet they don't do anything but
sit there and spin. The reason your automated sprites don't move is that you created
each of the automated sprites shown in Figure 4-2 with a speed of zero: that
is, in the LoadContent
method of the SpriteManager
class, you passed Vector2.Zero
as the final parameter of the constructor
for each of these objects.
To make your automated sprites move around the screen, try modifying the speed
parameter you pass to those objects. Be aware
that you have no logic built-in to do anything with these sprites other than move
them forward, though. The result will be that your sprites will move forward and
will eventually move off the screen. In coming chapters, you'll be adding some logic
to dynamically create sprites and send them flying from one side of the screen to
the other. This chapter and the sprite class hierarchy that you've built have laid
the foundation for that future development.
Get Learning XNA 3.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.