Sunrays!

Upload your latest creations here, and download the latest creations here! This is where the creative tool shop resides.
Post Reply
Dr. Madskull
Posts: 20
Joined: Tue Jun 04, 2019 11:35 am

Sunrays!

Post by Dr. Madskull » Thu Nov 21, 2019 11:54 am

Inspired from a discussion I created a sunray-emulator. :mrgreen:

Well, it looks nice at least, maybe looks a little like the monitor with green code falling in The Matrix movies, except this is yellow. The functionality is interesting though:

The sunlight is considered to be a 'package' of power, propagated downwards the ground. To simulate its ability to 'spread out' it does exactly that: It spreads out sidewards to its immediate neighbors. If there is an obstacle, the obstacle receives the light power unit, but it's opacity stops it from propagating it further. In short, it gets dark below the obstacle. The spreading out gives a nice soft shadow below obstacles.

Tip: Try clicking around to see the shadows at work! Increase or decrease the sunpowerGiveAway to understand the spreading.
Set randomizeElements to false to disable the random 'rain' and enable full 'level-editing'. :)
Attachments
yoss_sunrays.js
(9.48 KiB) Downloaded 128 times

Post Reply