How to generate a star field effect with depth using code?



I would like to generate a star field effect with depth for my game.

I will have several space sequences and would like to use graphical effects to generate layers of stars that move at different speeds and appear to have depth. I know I could layer several images and have them slide over each other but I would like to use the graphics card to generate them instead if possible. Then I can scale them, change depth, change colour and tweak how they are generated.

I am using Game Maker 1.4 and would like to use code to solve the problem

I'm not really sure where to start with this so any help will be much appreciated, thanks!
Last edited by a moderator:


I'd use images sliding w/ a smattering of "generated" stars that behave dynamically, enough to fake it all being full custom.