Forums

ForumsProgramming Forum

Flash game - light in the dark

Posted Jan 17, '12 at 10:12am

Dewi1066

Dewi1066

563 posts

What I want to do is have a scene that is in total darkness, so effectively just a black screen, but where the mouse moves I want to reveal a circle of the scene as it would be if it were lit (does that make sense?) I still want to use the mouse to select items at the same time though.

Really all I'm after is a starting point rather than code to do it, has anyone got any ideas? I've been reading and reading, but can't figure it out from the books I have.

 

Posted Jan 17, '12 at 1:20pm

Freckls627

Freckls627

33 posts

The only thing I can think of would be to have a circle that would follow your mouse around that would be a mask to reveal the level below.

This is how you would layout your levels.

Mouse Mask
Black Rectangle over level
Level

The mouse mask would reveal the level below while keeping the rest of the level black.

Hope this helps. If you have any questions feel free to ask.

 

Posted Jan 17, '12 at 8:50pm

Dewi1066

Dewi1066

563 posts

Thank you! I have a starting point, thats the main thing.

I desperately want to do this entire project on my own, but you know, it is becoming impossible to do what I want because the books I have are limited and I'm not familiar enough with Flash to realise its full potential.

Again, thank you though. No doubt I'll be back soon with more questions as I'm trying to tackle something right now that is a complete nightmare!

 

Posted Jan 18, '12 at 11:13am

Freckls627

Freckls627

33 posts

No problem,

Definitely familiarize yourself with masks, they're a little tricky to understand. You should check out videos on youTube, that's what helped me out a lot.

Even if you can't get it right away keep up the good work.

 

Posted Jan 18, '12 at 12:00pm

gaboloth

gaboloth

1,372 posts

It isn't the most pro way to deal with it, but you could make a big black rectangle with a hole in the middle, set the registration point in the center of the hole and make it follow the mouse.
(ignore my comment if this is what freck suggested...)

 

Posted Jan 18, '12 at 3:15pm

master565

master565

3,874 posts

If you wanted to do an extremely complicated one made out of small boxes (not to small), you can create an array of black boxes that cover the whole screen and either

A) Make their opacity lower as your mouse gets closer (flash probably can't handle this many distance calculations)

B) Have invisible circles with larger and radii following the mouse that change the opacity of these objects as they pass over, and each farther circle will lower the opacity less. You can also just use one circle if you don't want it to be as smooth. This method is more complicated but will probably run more smoothly.

 
Reply to Flash game - light in the dark

You must be logged in to post a reply!