Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
1  
Couldn't you just mask your buffer? Or have a texture with alpha overlayed on it? –  Sidar Oct 18 '13 at 0:37
    
if you want to mask in a rectangular area, consider using glScissor –  PeterT Oct 18 '13 at 1:01
    
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. –  Ephyxia Oct 18 '13 at 3:07
    
    
@sidar Thanks for the link I got it working. –  Ephyxia Oct 18 '13 at 22:38

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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