Actually, the hardware limit is 8 dynamic lights and, from what I can tell, an unlimited number of static lights. Using models and sprites might help "fake" dynamic lights to some extent.

As for the function, just replace the light_XX_action with whatever the actions are for your dynamic lights. This way, 8 of them get processed per frame, but, to make best use of it, you'll need a decent or sufficient frame rate or you may notice the "faking" of it.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials