1
\$\begingroup\$

I'm making a mining/building game in java using slick2D and I want to make it so you can only see a few blocks in any direction while you are underground. The best example I could find of what I want to do is the game miner dig deep.

enter image description here

One way I thought of doing it would be to have a large image and just draw transparent areas on it where you need to be able too see but even if that would be an efficient method I wouldn't be sure how to do that.

\$\endgroup\$
  • 1
    \$\begingroup\$ Couldn't you just mask your buffer? Or have a texture with alpha overlayed on it? \$\endgroup\$ – Sidar Oct 18 '13 at 0:37
  • \$\begingroup\$ if you want to mask in a rectangular area, consider using glScissor \$\endgroup\$ – PeterT Oct 18 '13 at 1:01
  • \$\begingroup\$ It needs to be circular and I'm mainly using the slick libraries for rendering. I don;t know that much about openG but if someone could provide an example I would be able to implement it. \$\endgroup\$ – Ephyxia Oct 18 '13 at 3:07
  • \$\begingroup\$ slick.ninjacave.com/forum/viewtopic.php?t=3598 \$\endgroup\$ – Sidar Oct 18 '13 at 10:06
2
\$\begingroup\$

I'd just make an image with a transparent circle in the middle and the rest entirely black. Then just render that over everything else in the game (except for the UI of course).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.