How do I cast light on an object and not the backgroundt

Get help using Construct 2

Post » Fri Apr 04, 2014 5:35 am

Hi All,

I'm having trouble casting light on a single object and not the surrounding background. I think I have the layers right, but something isn't working quite right with all the blending modes. Ideally, the light sprite would only 'shine' on the poker chip itself and not the surrounding background or UI (drag the green dot around to move the light).

If anyone can assist, it would be appreciated? I think I need a sprite in the masking layer that creates a mask of the object below, however I can't seem to get that working..

Any assistance would be much appreciated!
-Remy
You do not have the required permissions to view the files attached to this post.
B
72
S
14
G
1
Posts: 151
Reputation: 4,999

Post » Fri Apr 04, 2014 8:58 am

Have you tried the C2 EXAMPLE Lighting.capx try it and you will learn.
B
250
S
39
G
15
Posts: 1,953
Reputation: 40,623

Post » Fri Apr 04, 2014 8:59 am

If you have not then here is file
You do not have the required permissions to view the files attached to this post.
B
250
S
39
G
15
Posts: 1,953
Reputation: 40,623

Post » Fri Apr 04, 2014 10:44 am

You only want the light on the chip and nothing else ?

Here is a test of what I think you are after. Using large sprite. If you move the mouse/light to the far left of the screen the light is no longer hidden. Needs work...
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Sat Apr 05, 2014 1:00 am

RamPackWobble wrote:You only want the light on the chip and nothing else ?

Here is a test of what I think you are after. Using large sprite. If you move the mouse/light to the far left of the screen the light is no longer hidden. Needs work...


@RamPackWobble, this is exactly what I was looking for -- and the balloons brightened my day :D

Thanks!

-Remy
B
72
S
14
G
1
Posts: 151
Reputation: 4,999

Post » Sat Apr 05, 2014 6:54 am

Glad you like it - but it was using a large sprite to hide the spotlight , no problem on a PC but might need a "few coats of thought" for mobile...
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Sat Apr 05, 2014 9:48 pm

RamPackWobble wrote:Glad you like it - but it was using a large sprite to hide the spotlight , no problem on a PC but might need a "few coats of thought" for mobile...


Heh, and wouldn't you know that's my next problem.... I saw how you used the 'cut out' circle with "destination in" applied, however, in my context, I need to be able to dynamically switch the poker chip to other objects of choice. So, I can simply create a new object on the same "light" layer and set it's blend mode accordingly, however, if the objects aren't the size of the entire viewport I'm working with (which they never are), i get the light bleeding onto the background for any area in the view port that is outside the sprite's bounding box of the object created :(

I've tried having another "mask_sprite" that is blank sprite as big as the viewport I need the object to move around in. It also has a 'destination in' blend mode and instead of having another object sprite in that layer, I tried to Load Image From URL on the "mask_sprite" to programmatically place my object of choice into the "mask_sprite" sprite, however, now NO light is seen at all.

Any "coats of thought" on how I could either combine any give sprite/object with another background sprite in order to achieve the desired effect? OR if as mentioned about, I have one sprite that is the size of the viewport that I"m operating in that I can paste/load the object of choice in/onto? :)
B
72
S
14
G
1
Posts: 151
Reputation: 4,999

Post » Sat Apr 05, 2014 10:04 pm

Lordshiva1948 wrote:If you have not then here is file


Thanks, however, the example does not light only an object and not the background. The example @RamPackWobble provided solves most of my issue, however, there is a new twist now, referenced above

Cheers,
-Remy
B
72
S
14
G
1
Posts: 151
Reputation: 4,999

Post » Sun Apr 06, 2014 8:32 am

Are you only trying to highlight certain objects - something along the lines of "choose this one ?" but using light ? If so another option would be to just have the sprite with an animation you can play as required ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Sun Apr 06, 2014 8:48 am

I do not know what you mean but, is it like this
You do not have the required permissions to view the files attached to this post.
B
250
S
39
G
15
Posts: 1,953
Reputation: 40,623

Next

Return to How do I....?

Who is online

Users browsing this forum: amazingdream, Yahoo [Bot] and 20 guests