ForumsProgramming ForumFlash game - light in the dark

5 4884
Dewi1066
offline
Dewi1066
539 posts
Nomad

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.

  • 5 Replies
Freckls627
offline
Freckls627
31 posts
Nomad

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.

Dewi1066
offline
Dewi1066
539 posts
Nomad

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!

Freckls627
offline
Freckls627
31 posts
Nomad

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.

gaboloth
offline
gaboloth
1,613 posts
Peasant

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...)

master565
offline
master565
4,107 posts
Nomad

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.

Showing 1-5 of 5