Need help with light effects

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • EDIT: PLEASE READ RECOND POST FOR WHAT I WANT TO ACHIEVE WITHOUT READING THIS WALL OF TEXT!

    Recently, I've decided to put light effects in my game, so, I've made a layer with a black background, and put some elements in it with the "Destination out" effect to do the light effects. But of course, the light effects go over everything, including walls, and I wanted to change that, at least with walls, so the player can't see what's on the rooms except on the room he's at.

    After some hard thinking, instead of the player having a "cone of light", I've decided to changed to 13 lines, all following the mouse, but each with a sligthly different angle. And, when it collides with the walls, it changes it's size, if it collides with a vertical platform, I use a certain formula, if it's a horizontal one, another formula, and if it's not colliding with any of the walls, it goes to it's original size.

    <img src="http://dl.dropbox.com/u/73222231/light.PNG" border="0">

    My game

    My capx

    It works well, but I'm having trouble whenever you're looking from the side of a horizontal platform or looking to the top/bottom of a vertical platform.

    <img src="http://dl.dropbox.com/u/73222231/lightfail.png" border="0">

    I need help figuring out a way to fix the above error or to change how the light effects works at all!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, after some searching, I think I found an example of what I want to do, so, maybe, someone will be able to help me now...

    Can't turn it off

    I want to make that laser. But without the "reflective" gimmick. I want it to hit a wall and stop, not getting past it or anything.

    So...ideas?

    EDIT: Sorry, after 10 minutes I posted this, I found something that should work. If anyone is interested in the solution, it's in this post.

    Lazors

    And if you think you have a better solution, I'm all ears.

    For those that actually read my whole post and even tried to think something of something, thank you.

  • R0J0hound helped me out with reflective lasers some time ago, maybe this example can help you too?

    Scirra Forum Thread Link

  • Heh, thank you! I found a post similar to yours, where R0J0hound sent the same capx to the topic creator. I'll get that light up and running as soon as I can!

  • Here's an example of the current system that I'm using in Can't Turn it Off:

    Ray Cast Example

  • Wow, from the man himself! Thank you, dude, that should help a lot!

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