Need some help Please

Started by
1 comment, last by xterminenatorx 22 years, 6 months ago
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
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)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
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

This topic is closed to new replies.

Advertisement