BHT MIDIBHT Lightning
This is a plugin for Construct 3 by Scirra. Last updated: Oct 25 2020

This plugin provides the ability to draw lightning bolts and lightning text (that is, a lightning based special effect on white images).

  
Introduction

The plugin lets the user generate either single bolt, or branching lightning, in a given colour. The plugin also generates 'lightning text' where text (or any single or set of white objects) crackle with lightning between points across the white areas.

The mechanism does require various helper objects. The bolts require two sprite images, one for the bolt itself, and one for the end of the bolt.

Lightning text also requires some helper objects; a source object and a DrawingCanvas object. The source is drawn/pasted into the DrawingCanvas, and the the DrawingCanvas is passed into the Lightning plugin to extract the white pixel data. The image must be pure white, or the pxels will be ignored.

Please note: for the plugin to work properly, the lightning object's Blend Mode must be set to Additive!

Installing
From the C3 GUI, goto Menu->View->Addon manager. Select Install new addon... and navigate to the c3addon file. Select it and Open.
Properties
Sway
Lightning bold segments can sway +/- this number of pixels.
Envelope
Lightning bold segments near the middle of the bolt can be further from the central line. This value limits the distance.
Min text arc range
Minimum range to consider for creating lightning-text arcs.
Max text arc range
Maximum range to consider for creating lightning-text arcs.
Show outline
Show the outline of the object for debugging purposes.
Conditions
On canvas extraction finished
Triggered when the canvas image has been extracted, processed, and random points picked to generate lightning bolts between.
Expressions
Sway
Get the sway value.
Envelope
Get the envelope value.
MinTextArcRange
Get the minimum text arc range.
MaxTextArcRange
Get the maximum text arc range.
Actions
Create a lightning bolt
Create a lightning bolt given endpoints, thickness, persistence, and colour.
Create branching lightning
Create branching lightning given endpoints, thickness, persistence, and colour.
async Extract canvas
Extract pure-white data from the given Drawing Canvas object to generate synchronized lightning effects across the white areas in the canvas.
Extract half-circle image for compositing lightning bolt
Extracts the image from the given Sprite and reuses it for drawing the ends of the lightning bolt.
Extract segment image for compositing lightning bolt
Extracts the image from the given Sprite and reuses it for drawing the middle of the lightning bolt.
Set envelope
See the Envelope property for details.
Set sway
See the Sway property for details.
Set the maximum text arc range
See the Max text arc range property for details.
Set the minimum text arc range
See the Min text arc range property for details.
Downloads
BHT Lightning - c3addon - v1.0

Lightning example - c3p - v1.0

Lightning example