Or play Here.

A snake game using a CRT filter I made using raw JavaScript. It was fun to make and took me maybe a day. I hope you enjoy and can be inspired! 

The CRT itself simply is called from a function that takes pixel width, height, spacing x, spacing y, and default light values in that order. The system runs through each pixel on the screen and sets the alpha to 0 to make everything fully transparent. 

Next the System runs through each pixel that is spacing y, and spacing x apart and adds it to an important pixel array. This array is used in the next function, which cycles through row and column of pixels and formats the important pixel data in the CRT pixel structure. This means each important pixel's red, green and blue values are taken out and spread across the width, height and location specified by where the important pixel is located. Note that this step also changes each edited pixel's alpha to 255.

Then, the CRT runs through each pixel with an alpha value of 0 (The pixels that were not edited) and sets the colour values for red, green, and blue to 0 - making the non-important pixels black.

This whole function can be called whenever - even multiple times per frame and with different settings (Cool effects). This makes it very diverse. 


Comments

Log in with itch.io to leave a comment.

If anyone is interested I might post the source code for the CRT somewhere.