Dynamic Light

i’ve seen this in games before, and i was wondering how it’s done. does anyone know how to make light rays that are blocked by objects, such as walls, enemies, or the hero?