Time for action – viewing the Sprite and Camera classes in action
In the declarations area of the
Game1
class, add a declaration for a temporary sprite object:' Temporary Demo Code Begin Private tempSprite As Sprite Private tempSprite2 As Sprite ' Temporary Demo Code End
In the
LoadContent()
method of theGame1
class, initialize the temporary sprite and theCamera
class:' Temporary Demo Code Begin tempSprite = New Sprite( New Vector2(100, 100), spriteSheet, New Rectangle(0, 64, 32, 32), Vector2.Zero) tempSprite2 = New Sprite( New Vector2(200,200), spriteSheet, New Rectangle(0, 160, 32, 32), Vector2.Zero) ' Temporary Demo Code End
In the
Draw()
method of theGame1
class, draw the temporary sprite:' Temporary Demo Code spriteBatch.Begin() tempSprite.Draw(spriteBatch) tempSprite2.Draw(spriteBatch) spriteBatch.End() ' Temporary Demo Code End
In the
Update()
method of theGame1
class, add temporary input handling to allow the sprite and the camera to...