Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Multiple enemies with 1 function

Author
Message
Kerl
User Banned
Posted: 19th Mar 2012 06:35
Hello again,
I am currently working on a 2D game where I want the enemy to move closer to the player while it is alive.
Then, once the enemy is killed a certain number of times, move on to the next level where there will be 2 enemies (so on and so forth).

I got the code down for moving the first enemy, that is no problem. But I am stuck trying to figure out how I can increase the number of enemies while still only using this single function.
Also I would like the new enemy to be a different sprite on every level so its not just a bunch of the same looking enemy.

Here is my code so far:

Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 19th Mar 2012 15:03
Make 1 enemy class and instance it for all of the different enemy's, that is how I do it.
Kerl
User Banned
Posted: 19th Mar 2012 21:37
ahhhhh I see! I seemed to forget one of the basic rules of classes. I guess I just got caught up in using the same old code structures over and over. Up until now I have only ever needed to call each of my methods once.
vitinho444
13
Years of Service
User Offline
Joined: 12th Oct 2010
Location:
Posted: 20th Mar 2012 15:40
So can we make like a class and in the end put [10] to 10 enemies?

C++ Medium 3.5/5
www.oryzhon.com <-- My company's website (W.I.P)

Login to post a reply

Server time is: 2024-04-20 12:26:53
Your offset time is: 2024-04-20 12:26:53