This project is read-only.

Lightsprites ?

Jan 20, 2012 at 4:43 PM


is it possible to add custom sprites for the lights?

currently we have only "sprites" like this
but i want a light like that:

Jan 20, 2012 at 10:17 PM

Hi there!

I believe this should be possible. If I'm not mistaken you could generate a new texture from a png file and use that for your a new method in LightTextureBuilder. Not sure if that would be the most efficient way, but your other option would be to work out the math equations to generate that light.

Xixonia may be able to shed more light on this.

Jan 21, 2012 at 3:15 PM

Nice pun, dindak. :P

Heyo, DarkPrisma!

You can use any texture you want for  any light you want. You simply load the texture using ContentManager.Load<Texture2D>("ResourceName"), and assign that texture to the Light2D's "Texture" property after you've instantiated the light.

        protected override void LoadContent()
            // Create a new simple point light texture to use for the lights
            this.mLightTexture = ContentManager.Load<Texture2D>("MyAwesomeLookingLight");

            // Create some lights and hulls
            this.CreateLights(mLightTexture, this.mNumLights);
            this.CreateHulls(this.mNumHorzontalHulls, this.mNumVerticalHulls);

            // Create a light we can control
            this.mLight2D = new Light2D()
                Texture = this.mLightTexture,
                X = 0,
                Y = 0,
                Range = 25,
                Color = Color.Multiply(Color.CornflowerBlue, 2.0f),
                ShadowType = ShadowType.Occluded



Jan 21, 2012 at 6:43 PM

thank u! I will try it :D

Jan 22, 2012 at 8:18 AM

Hehe :)