[Suggestion] Drop shadow behavior

0 favourites
From the Asset Store
320 high-quality cinematic sound effects for trailers and game scenes.
  • I saw that the Canvas element support rendering drop shadows, and by what it seems this includes images with transparency too.

    So maybe could be possible to create a behavior that applies drop shadows to objects with parameters Offset X, Offset Y, Blur and Color.

    I'm not diving into plugin development yet, so if it's feasible and anyone wants to give it a try here's my suggestion.

    Probably would be harder to make it work with WebGL, but even if it's Canvas 2D only should be useful as well.

  • I was looking into this (and I've just started looking at the SDK). I think the drop shadow code would have to be in the object's draw function. As far as I can tell, behaviors can't draw on the canvas. At least none of the existing ones do.

    You could make a new object 'DropShadowSprite' easily enough but it seems like overkill to create a copy of the Sprite plugin just to add this effect. What do you think?

    A drop shadow text plugin could be useful and text is rendered to a 2d canvas anyway. Or it's something that could be added to the built-in plugin easily enough. I wonder what Ashley thinks of that?

  • ramones is right that behaviors can't draw.

    I would recommend waiting for us to add WebGL shaders - when we do it we'll also be adding a few limited effects that canvas 2D supports, like dropshadow.

    A possible problem with dropshadow is in the past I've seen it cause browsers to fall back to a software rendered canvas 2D... not sure if that's fixed.

  • I made a drop shadow text plugin anyway.

    Demo

    dropshadowtext.zip

  • Ashley It will be possible to put in Shadows when r100 is out?

  • I know I said we would add effects support for it, but on further consideration I don't think it's a good idea. A dropshadow with a heavy blur could render 5-10x slower than just using a black silhouette sprite with a blurred image which is pinned to another object. That's really a better solution.

  • Why not have an effect which does that for you automatically? :)

  • Ashley Yeah, but I mean dynamic shadows, realtime shadows, don't know if you get it.

    I don't know if this would be possible in r100 or if this is any method to do it, really I didn't try anything right now.

  • You can always make a main sprite, then make a grey object with a blur effect applied to it and put it behind the main sprite. That'll give you a shadow effect. That's what I'm doing for my game.

  • how about if you want to make the dynamic drop shadows a gameplay mechanic, similar to

    stealthbastard game

    Whats the simplest way to achieve that in construct 2?

  • I've tried many of the examples in the forum but I've found that it's super hard to get dynamic shadows that perform well in large complex layouts

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess that sconstruct 2 will never be able to produce a game such as stealth bastards (made with Game maker Studio)

    stealthbastard.com

    I should look into learning game maker then?

    yoyogames.com

    youtube.com/watch

    their licenses are a bit more expensive though

  • guess that sconstruct 2 will never be able to produce a game such as stealth bastards

    Well, just because you haven't found a way to do it yet doesn't mean it can't be done. From what's on these forums there are ways to draw the shadows. There just isn't an example made yet to test if an object is in shadow. As a simple idea the line of sight behavior could be used from the lights to the player and if there isn't a LOS then the player must be in shadow. There are probably other ways though.

  • ramones the link for dropshadowtext.zip is down. Could you or someone reupload? Sorry to necro, i can't message with a new account

  • The .zip is still down ...

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