The problem I am having is that when I am using the Load Sub, the For Loop does not add images to the list, as seen by the Message Box of the Count Property of the List(bswimages)(Returns 0). How do I fix my code in order to have the images put in the list. Thanks in advance.
Code:Private bswimages As New List(Of Texture2D)() Protected Overrides Sub LoadContent() ' Create a new SpriteBatch, which can be used to draw textures. spriteBatch = New SpriteBatch(GraphicsDevice) ' TODO: use this.Content to load your game content here 'Load BShooterWalk Animation Content (pngs) Dim bswimages As New List(Of Texture2D)() Dim bswfolderPath As String = "Images/BShooterWalk/" For i As Integer = 0 To 33 Try If i <= 9 Then bswimages.Add(Content.Load(Of Texture2D)(bswfolderPath & "bshooter_" & "00" & i & Convert.ToString(i.ToString))) Else bswimages.Add(Content.Load(Of Texture2D)(bswfolderPath & "bshooter_" & "0" & i & Convert.ToString(i.ToString))) End If Catch Exit Try End Try Next MsgBox(bswimages.Count) End Sub




Reply With Quote
