• Advertisement

Archived

This topic is now archived and is closed to further replies.

Need some help Please

This topic is 5969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Iam making a Space Invaders type game for my first game ever and well I have been wanting to know how I can make the enemies go left to right. I need for this to be a pattern were enemy one goes here and enemy two goes here just like in the space invaders, but I keep getting this probably when I find a way to move them, how do I add all the enemies in and put them in those diffenert positons and move them according to how each indiviual goes. Someone told me to use a class for it, but I don''t see how this works. Thanks to anyone who helps. Daniel

Share this post


Link to post
Share on other sites
Advertisement
i don''t know what language you are using, so i''ll try to stay general...
make a class called "AlienClass". it should have members for X and Y coordinates, as well as other stuff (like what graphic to use, etc)...
then either make an array of objects of this class (10 by 4 or whatever), or make a collection of 40 of them...
then, set up each object to have the proper graphic, and assign an X and Y coordinate (so they are spread out in a grid)...
now, when you want them to move "d" pixels to the right, just add "d" to the X member of each objectin your array/collection... to move left, subtract "d" from it... when you want them to drop lower because the hit the edge of the screen, add some number to the Y member of each alien.
that should get you the basics of a grid of aliens moving back and forth, and down...
HTH

--- krez (krezisback@aol.com)

Share this post


Link to post
Share on other sites
Thanks, Iam using Visual C/C++ 6.0, I was wondering though, if you could could you please type the code and put it up or e-mail it, because its hard for me to understand being a beginner, with just words. Thanks,
Daniel

Share this post


Link to post
Share on other sites

  • Advertisement