[SOLVED] Using a mask to create a light

duud

  • Posts: 96
Hi!

Could somebody explain me step by step how to use a mask to create a light? It is a Challenge 2 on Image API tutorial so it should be quite straightforward, but I can not find a way to do that. I've got a bright background actor in the back layer which is imitating a day and on top of that I've got a dark background actor which is imitating a night as well as my mask actor (a triangle-esque dark imitation of light). I want to "cut out" my mask actor so that it is bright from the bright background actor, thus imitating a light. The ultimate goal is to create a headlight for the car driven by a player at night.

I am attaching my blocks - maybe somebody will be able to explain to me what I am doing wrong.

Thanks!

« Last Edit: July 19, 2014, 11:03:58 am by duud »
I am currently working on SocioPath, an interactive experience about the existence of a contemporary man. You can play a demo on http://gamejolt.com/games/adventure/sociopath/33079/

duud

  • Posts: 96
Anybody? It is a really important thing for me to understand it.
I am currently working on SocioPath, an interactive experience about the existence of a contemporary man. You can play a demo on http://gamejolt.com/games/adventure/sociopath/33079/

sdieters

  • Posts: 2068
you should wait at least 24 hours before bumping. most users dont like it, and will most likely not reply because of it.
i cant help you tho, i have done allot with stencyl so far, but never worked with the image API stuff.
i will have a look at it, but cant promise anything

My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

duud

  • Posts: 96
My topic fell to the second page, so I guess anybody would notice it, but thanks for explaining the netiquette. Does anybody have a really good grasp of the Image API?
I am currently working on SocioPath, an interactive experience about the existence of a contemporary man. You can play a demo on http://gamejolt.com/games/adventure/sociopath/33079/

sdieters

  • Posts: 2068
I know there are a couple of tutorials on how to do that. Have you searched for them? I know there is one made by SunriseKingdom
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

duud

  • Posts: 96
Could you place links to those you know about?  :)
I am currently working on SocioPath, an interactive experience about the existence of a contemporary man. You can play a demo on http://gamejolt.com/games/adventure/sociopath/33079/

rahay

  • Posts: 6
that's how I made ​​light and shadow
not the best option

image API mask - button 3

duud

  • Posts: 96
Ok, I managed to deal with it, but it took me a really long time. And basically the problem was that my files had a wrong bit depth. After I changed this parameter to 32 (adding an alpha channel with GIMP), it worked. It is really annoying - I think it should be clearly stated on Stencyl website by the creators.

Nevertheless, I came across another problem. I want to use the mask as car headlights, so I want to change its position dynamically. Is it possible? If I simply use "clear image ... at x of headlights, y of headlights" it is not working because the part that has already been masked is not returned to its original form. I would like to achieve an effect like in Tuo's "Demo Light Sources with Image API" from StencylForge.

« Last Edit: July 18, 2014, 09:33:05 am by duud »
I am currently working on SocioPath, an interactive experience about the existence of a contemporary man. You can play a demo on http://gamejolt.com/games/adventure/sociopath/33079/

rahay

  • Posts: 6
I solved this problem, look at the attached files (See the previous message)
1 - static light source
2 - Dynamic light source, attached to the mouse cursor

duud

  • Posts: 96
Thanks for your suggestions and willingness to help, guys. I found a way to bypass Image API and create the light in a different, much less complicated manner. If somebody reading that wants to know the details - just send me a message.
I am currently working on SocioPath, an interactive experience about the existence of a contemporary man. You can play a demo on http://gamejolt.com/games/adventure/sociopath/33079/

rahay

  • Posts: 6
I want to know another way  :)
but I need, мultiple light sources

duud

  • Posts: 96
I just created a big actor who is essentially a black rectangle twice the width of the scene with a hole exactly in a shape of the light. I put this actor on top of the scene, set its opacity to 96%, align with the light and move it in the scene along with the light as well as the car.
I am currently working on SocioPath, an interactive experience about the existence of a contemporary man. You can play a demo on http://gamejolt.com/games/adventure/sociopath/33079/

rahay

  • Posts: 6
Unfortunately, this method is only suitable for a single light source
I need at least two or three light sources

duud

  • Posts: 96
I suggest you create a new topic, since this one has already been moved to "Resolved Questions" section.

Take care
I am currently working on SocioPath, an interactive experience about the existence of a contemporary man. You can play a demo on http://gamejolt.com/games/adventure/sociopath/33079/