This project is read-only.

Detecting if an object is 'lit'

Jun 22, 2011 at 5:58 AM

Hi there, new to Krypton, but so far liking's handling lighting for a game port I'm working on very well.

The game I'm working on porting depends on lights which illuminate I need to know if the targets 'get hit' by the light.  Is there a way for an object to do collision detection with the lights to find out if it's being hit?

Jun 28, 2011 at 9:46 AM

Krypton is not the right tool for managing the game logic, as it's focused on visual effects, so probably you will need additional code to check if something is hit by the light, like raycasting.

Nov 1, 2014 at 8:17 PM
Edited Nov 7, 2014 at 7:15 PM
I believe you could call light.bounds.intersects and use collision boxes in the standard way. Basically, you have two non-rotated rectangles, and it will return true if they intersect.


Further research shows this is NOT the case. Krypton doesn't use a standard rectangle class, and intersects is not compatible without some manipulation.

Something like this
        If Player.HitBox.Intersects(New Rectangle(light.Bounds.Left, light.Bounds.Bottom, light.Bounds.Width, light.Bounds.Height)) Then