Flashlight (Plugins)

0 favourites
  • Flashlight — Now for sale in the Scirra Store!

    https://www.scirra.com/store/construct2-plugins/flashlight-4380

    <h3>Introduction</h3><div class="deshr"></div><p>Flashlight is like a source of light that casts shadows from other objects. It displays images and animations and detects overlapping objects. It then clips the rendered image to make it look like it has shadows. </p><h3>Actions</h3><div class="deshr"></div>

    • Draw full then disable. This draws the full image then disables the plugin.
    • Enable redraw. Set whether the plugin will detect and then redraw its shadow shapes.
    • Light height. Set the pixel height for the light.
    • Light radius. Set the radius of the light source, in pixels.
    • Ignore inst ? add / clear list / remove. The instance ignore list allows you to manage whether or not particular instances of an object are allowed to interact with the Flashlight object.
    • Ignore types ? add / clear list / remove. The types ignore list allows you to manage whether or not an object type (all instances of an object type) will interact with the Flashlight object.
    • Shadow casting types. This allows you to choose whether the plugin uses Solids, Flashlight Shadow behavior or Other object types.
    • Shadow list ? add / clear / remove. Manage which object types can interact with the Flashlight object, whether or not they have Solid behavior or the Flashlight Shadow behavior.

    <h3>Conditions</h3><div class="deshr"></div>

    • Enabled. Returns true if the plugin is enabled to detect objects and draw shadows.
    • Is blanked out. If the object height is zero then the Flashlight plugin hides the light image if it overlaps a shadow-object?s collision polygon.

    <h3>Expressions</h3><div class="deshr"></div>

    • LightHeight. The pixel height of the Flashlight?s height.
    • LightRadius. The radius of the Flashlight object?s light.

    <h3>Limitations</h3><div class="deshr"></div>

    • Edge size. The minimum edge length must be bigger than the Flashlight?s diameter.
    • Minimum vertex angle. The minimum corner angle that is supported is 90 degrees. This is a limit of the plugin because of how the shadow casting edges are determined and how their shadows are drawn.
    • Object shape. Only convex shapes are supported.

    Use this topic to leave comments, ask questions and talk about Flashlight

  • looks interesting, maybe upload demo game ?

  • looks interesting, maybe upload demo game ?

    Thanks! I'm working on a demo right now... It should be ready in a day or two.

  • It's really a good idea

    Creating c-shadows becomes easier than ever!

    And not just the shadows...

    I have two questions about improving

    1. Simple adaptation to the inclination of the plane. In TopDown, the ratio X:Y - 1:1.

    In 2.5D or a perspective scene it can be, for example 1:0.5 (0.2 ~ 0.7).

    Is it possible to add the option "2.5D view" with the choice of scaling Y from 1 to 0, or something like that?

    2. Option: the shadow at the bottom of the object - i.e. Shadow only within the collision mask?

  • repkino - those are both really good suggestions. Let me have a think about how I could implement them and I'll get back to you.

  • It's really a good idea

    Creating c-shadows becomes easier than ever!

    And not just the shadows...

    I have two questions about improving

    1. Simple adaptation to the inclination of the plane. In TopDown, the ratio X:Y - 1:1.

    In 2.5D or a perspective scene it can be, for example 1:0.5 (0.2 ~ 0.7).

    Is it possible to add the option "2.5D view" with the choice of scaling Y from 1 to 0, or something like that?

    2. Option: the shadow at the bottom of the object - i.e. Shadow only within the collision mask?

    if you still implementing code in your addon, maybe add condition: 'is in shadow' this could help create sneak games

  • if you still implementing code in your addon, maybe add condition: 'is in shadow' this could help create sneak games

    Already has it - "Is blanked out" is the condition that returns true if an object is in a shadow that was created by one or more other objects. I might rephrase it for the next update so it's easier to understand.

  • There's a fun little demo now available, to show you what sort of thing the plugin can do. Please check it out here.

  • There are 2 bugs I'm working on:

    Doesn't paste onto Paster (I expect a fix soon).

    Doesn't render alpha when on a layer with render own texture (needs investigating, not replicated yet).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There's a fun little demo now available, to show you what sort of thing the plugin can do. Please check it out here.

    make also demo with other colors of light like in top down shooter

    Q: how much decrease FPS this plugin? (performance is very important)

    Q2: its possible to make very bright flashlight and very dark shadow ?

  • I've been waiting for a plugin like this for awhile. Very easy to set up and use too.

    However, I have a really large tilemap (over 32,000px square) and performance absolutely tanks when I add only 1 small light in. It seems like the light is evaluating the entire map instead of the small area that it covers. Can the performance be optimized for large levels?

  • Q: how much decrease FPS this plugin? (performance is very important)

    Q2: its possible to make very bright flashlight and very dark shadow ?

    Q1. This plugin gives better performance, shadow for shadow, than the standard Shadowcast plugin system, in my opinion. This is because the shadows are per object (and more often than not, don't cover the whole screen area). Also, you don't need a 'render own texture' layer for each light object. The performance is not as good as for a standard sprite object, unless there are no shadows (in which case it is nearly identical). If you have many/numerous shadow objects inside one big object then that can cause an overhead - each shadow vertex and each shadow penumbra adds up, so you can't just throw in dozens of flashlights / shadow objects and expect it to work at 60 fps on a mobile. Not with html5 etc. Once I've got things better set up then I'll run some performance comparisons on my system (intel hd4000).

    Q2. Yes, but you are limited by the blend modes and effects available in c2. You can put your Flashlights on a layer with 'render own texture' set to yes, transparent set to 'no' and a background color black. Set opacity to whatever you want and then set the Flashlight blend to 'destination out'. This will draw a hole in the black background of that layer. As this quick example:

  • I've been waiting for a plugin like this for awhile. Very easy to set up and use too.

    However, I have a really large tilemap (over 32,000px square) and performance absolutely tanks when I add only 1 small light in. It seems like the light is evaluating the entire map instead of the small area that it covers. Can the performance be optimized for large levels?

    Thanks for buying it and the feedback. I will see if there are any performance fixes that I can apply to the tilemap. As it stands, c2 provides a list of all of the collision shapes, one for each tile, after an overlap check. The plugin shouldn't draw all of them if they are not overlapping, but it does loop through each one. I suspect that I will be able to make some performance savings here - give me a couple of days and I'll see what I can do.

  • Bug update:

    Paster is supported, but you have to let Flashlight run for at least one tick first. I will fix this in the near future, it's just an order of events and functions tweak I have to make.

    Update - Paster is now fully supported. You can use action 'force early draw' to draw the image in the same tick that it is created, if Paster is to be subsequently used in the same events.

  • Update v1.01 submitted to the store for approval.

    Added optimizations for tilemap rendering.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)