Time for action – creating the Camera class
Add a new module called
Camera
to the Robot Rampage project.Add declarations to the
Camera
module:#Region "Declarations" Private _position As Vector2 = Vector2.Zero Private _viewPortSize As Vector2 = Vector2.Zero #End Region
Add properties to the
Camera
module, to access and modify the underlying members:#Region "Properties" Public Property WorldRectangle As Rectangle = New Rectangle(0,0,0,0) Public Property ViewPortWidth as Integer Get Return CInt(Int(_viewPortSize.X)) End Get Set(ByVal value As Integer) _viewPortSize.X = value End Set End Property Public Property ViewPortHeight As Integer Get Return CInt(Int(_viewPortSize.Y)) End Get Set(ByVal value As Integer) _viewPortSize.Y = value End Set End Property Public Property Position As Vector2 Get Return _position End Get Set(ByVal value As Vector2) _position = new Vector2( MathHelper.Clamp...