[CAPX] Yet another shadow caster

0 favourites
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • https://dl.dropboxusercontent.com/u/5426011/examples18/shadow_cast_2.capxr142

    Yet another shadow caster example but this one is has a capx to dissect. It's probably very similar to what keepee did in his example. The shape of the objects is defined by imagepoints.

    Features:

    * Colored additive lights.

    * Changeable shadow color.

    * Adjustable resolution to get a balance between look and performance.

  • Nice work, as always, R0J0hound. You might want to mention that this needs your Canvas plugin in order to view.

  • Very cool. I like the effect when you place a light ON a shape!

  • Oh cum on , rogo :O

    Where did you find out about my method :3

    Edit:

    Ashley , Can you give us access to the collision polygons points in runtime ? That would make much stuff easier ...

  • <img src="smileys/smiley32.gif" border="0" align="middle" /> great!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hey, actually i did it kinda different... I used a canvas for each lightsource.. Yours is faster.

    I was going to say it'd be cool if anyone improved upon it but you're way ahead of me haha.

    Check my array for the imagepoints though, that way it doesn't need to repeatedly calculate the same things when drawing the shadows..

  • Really impressive work, Construct2 really need to have some native lighting system like that :)

    Impressive work !!!!

  • Well , Rojo Extended my capx , so no need for me to continue upon it ...

    But same method than the one I used :D

  • Really impressive work, Construct2 really need to have some native lighting system like that :)

    Impressive work !!!!

    Then Construct would be too awesome to handle by me

  • I'd like to use your two-canvas method as it's (in cases of 2+ lights) faster than doing the canvas-for-each-light thing that I did.

    But I've tried and failed to get it working neatly with scrolling, rotation and scaling, because the main canvas should really fill the screen on a stationary layer.. I can't think of any way to paste the light sprite(or falloff) the way it'd be required to. Was wondering if you had any ideas.

    the canvas-for-each-light method doesn't require any extra fiddling, I included this stuff when i updated with the new plugin if you want to have a look

    edit: also needs to work alongside standard non-shadowcasting lights that don't need to use canvas.. this complicates things more

  • keepee

    I don't have access to c2 ATM but my thought on how to handle scrolling and such would be to have the canvas' on a fixed layer and just translate the image point positions to the fixed layer. I believe there are some system expressions that can do the conversion. Everything else could be on other layers that scroll and shouldn't need repositioning to paste... I may be wrong as I haven't tried pasting to another layer that has a differing offset. If it doesn't then the falloffs and such will have to be moved before pasting and then moved back after.

  • A zeldaish quadrant style scrolling might work.

    Basically after the player gets to a certain x, or y the camera scrolls the length of the viewport, rather than just move a little at a time.

  • Is it possible to include a destination in effect on the falloff, which would allow textured objects to be in shadow until the light is over them, rather than just a black space.

    That make sense?

    If I convert one of the objects in this example, say the star to have multiple colours, it shows up even if there are no lights around.

  • R0J0hound

    Sorry to bother you, but can you think of a way to have the canvas serve as a destination in effect. I've tried adding it myself but to no effect.

    Also, I can't seem to figure out how to put a background texture in the example you've produced. Each time I do, the coloured lights just appear to wash away any detail.

    Hope you can help. I've been working on this mini-project for the last couple of days, only to suddenly hit this potential roadblock.

    If you'd like to see the capx I've been working on, I can pm it to you?

  • Sorry, I don't login too much and I miss many posts.

    For the first Q you're talking about an object casting shadow and being visible when lit, right? One idea that comes to mind would be to only cast edges facing away from a source. Although it wouldn't work great for concave objects.

    For a texture underneath you could reduce the opacity of the gradient sprites. I don't entirely recall what the example does so I'd have to tinker with it. Another idea would be to reduce the opacity of the color fill.

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