Your fundamental problem seems to be lacking a way to store references to all of your enemies. Generics and collections provide a solution to this type of problem. I'll use a List<T>
, which is the most basic such collection. There are many others, however, that each have their own useful properties.
Consider :
private class Enemy
{
public int position;
}
private List<Enemy> enemyList = new List<Enemy>();
private void timer1_Tick(object sender, EventArgs e)
{
enemyList.Add(new Enemy());
}
private void timer2_Tick(object sender, EventArgs e)
{
foreach(Enemy enemy in enemyList)
{
enemy.position++;
}
}
Also consider that updating a large list of visual objects every 0.001 second is useless and wasteful. One millisecond updates correspond to 1000fps. No video device will update that fast and no human being can see that fast. Generally, for real-time updates you should aim to update between 30-60fps. That corresponds to no more frequently than about 0.016s (16ms).