Hello!
I'm amateur who has been learning C programming for a couple of years and has recently moved to C#. I have been doing some reading on basic OOP concepts and I would like to program a very simple 2D game. I'm not using XNA, just the basic C# library and Windows Forms.
My question is: how should I manage the time? I know the "idea" behind a game loop, but how can I synchronize it so that my objects for instance will move at a determined speed? Which classes should I study to manage this? How difficulty is it?
Also, as a begginer in OOP, please tell me if this kind of design is adequate or if there are better objects.
At the beggining of the application, I create a List of objects:
Code:
List<Enemy> EnemyList = new List<Enemy>();
EnemyList.Add(enemyType, Xpos, Ypos); // pseudocode actually
EnemyList.Add(enemyType, Xpos, Ypos);
EnemyList.Add(enemyType, Xpos, Ypos);
And this how I'm thinking of handling it in the main loop:
Code:
foreach (Enemy t in EnemyList)
{
Enemy.Move();
Enemy.CheckCollision();
}
Is that OK? I just recently found about the List keyword (I guess that's some sort of simpler double-linked list no?) and to me it looks like an approach that could work.