I have a mission to make a small game for a school project. Boxes with pictures moved by a timer for walking enemies. If there are about 5 or 6 boxes of moving images in the form, my application gets problems and delays. After I kill some enemies (remove them from the collection of form / panel controls), it will return smooth.
I think the enemy movement cycle is too complicated, but I donβt know how to make it easier.
Private Sub TimerEnemyMovement_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerEnemyMovement.Tick
For Each Enemy As Control In PanelBackground.Controls
If Enemy.Name.Substring(0, 5) = "Enemy" Then
_enemy.MoveEnemy(Enemy, 2)
End If
Next
End Sub
I also thought about multithreading, but not sure if this will solve the problem, and there is a problem that I cannot access the controls of my main form.
You know, I have little knowledge about vb.net
Any ideas how to fix this backlog?