I want to create enemies on the fly. Say, every time I press E, an enemy appears in a random place. Here is what I have right now.
Right? Fairly simple, I just made a class. Everything is public right now because I'm new to classes and I don't want to have to dick around with the tangled mess that is private/protected elements.
So right now, I could, for example, have a ton of lines that go something like
and then a whole "if enemy1.health = 0 then enemy1 = new enemy blah blah blah", but either I'd have to declare a LOT of enemies (not fun) or limit myself to how many enemies are on the screen at a time. Limits are good, yes, but I don't like the idea of hitting a cap and having the game crash when it tries to make one more, regardless of how high the cap is.
So how would I go about doing this? Like I said, I'm new to classes so I might not even be doing THIS right, but hey.