Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Pixelbox

Create 2D games in JavaScript, made easier · By Cedric Stoquer

2D Raycasting - Directional Light? (Flashlight)

A topic by lesbianham created Nov 01, 2020 Views: 472
Viewing posts 1 to 1

Been playing around with Cedric's lightcast, and finally got it working with the current version of Pixelbox. Now I'm wondering what I'd have to do in order to work with a directional light, rather than an area light (I believe this is the correct terminology, but please correct me if I'm wrong!)

Here's the lightcast source: lightcast

I'm not even sure if the code I'd have to alter is in main.js or somewhere else.

The picture below shows what the code is doing currently. Rather than this, I'd like to have it work more like a flashlight, so that the lit tiles correspond to the rotation of the sprite. How can I do this? Thanks!