Lightsprites ?

Jan 20, 2012 at 3:43 PM

Huhu,

is it possible to add custom sprites for the lights?

currently we have only "sprites" like this http://www.makerland.de/Licht2.png
but i want a light like that: http://www.makerland.de/Licht.png

Developer
Jan 20, 2012 at 9: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.

Coordinator
Jan 21, 2012 at 2: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
            };

            this.krypton.Lights.Add(this.mLight2D);
        }

 

Jan 21, 2012 at 5:43 PM

thank u! I will try it :D

Developer
Jan 22, 2012 at 7:18 AM

Hehe :)