Starfield

Started by
2 comments, last by Matimeo 23 years, 5 months ago
I''m currently trying to make a space shooter for DOS(I''m gonna convert it to DirectX and OpenGL after I''m done). I was wondering if anyone has any ideas about how I''d go about having clouds(nebulas) randomly moving across the screen?
Advertisement
probably some sort of particle engine would work best. that way you can have as many clouds as you want.

JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Side scrolling or moving towards you? Side scrolling is easiest. Just make a bitmap wider than the screen with the image. Then update the x offset into it every frame. The if you are the window width from the edge or more blit it into the back buffer. If you are less than a width away then you have to do two blits. If you want the illusion of depth then use two or more and have the "closer" ones move faster than the "further" ones.

Moving into the screen you stretch instead of scroll. You can view the bitmaps moving at a velocity. The x and y of the velocity vector gives you a quantity to add/subtract from the edges of the source rectangle. The velocity is accelerated so each frame you multiply it by an acceleration. When the source rectangle drops below the size of the screen you reset the velocity and source rectangle then start over. You can use multiple bitmaps as well. They all start their cycle with the same velocity and accelerate at the same rate. Initially they are at even intervals with the appropriate velocity at that point. The bitmap can really be as small as still looks good. The smallest star is one point so if it is 1/25th of the screen it is going to be 25 pixels at the screen. If you use at least two bitmaps then you can randomly generate the bitmap each time it resets.
Keys to success: Ability, ambition and opportunity.
Thanks

This topic is closed to new replies.

Advertisement