[RESOLVED} Dark background, telescope effect

Started by Joacim Andersson, Fri 27/12/2024 18:45:05

Previous topic - Next topic

Joacim Andersson

In a game I want the character to look into a telescope and I then switch room, where the player isn't visible, instead it only sees part of the room, like a circle and everything else is black. However, this circle should be controlled by the mouse so you can see different parts of the room.

I similar effect is done in King's Quest II: Romancing the Stones, when Graham enters a dark area near the Sharkees, only the area around the player is lit up and the rest is dark.

I know about SetAmbientLight and Region.LightLevel but that doesn't affect the background.

Is there any way I can do this?

EDIT: I solved this by using an object that has a black sprite with a transparent "hole" in the middle. The sprite is twice the size of the room, and I move the object relative to the mouse position. However is there a smarter way of doing this?

eri0o

Your approach works, and that is totally fine.

Other approach if you need could be to have 5 pieces, one of the center that is the circle or whatever you want and four others that are top, bottom, left and right in a way that they fit the room. You can use overlays and adjust their width and height dynamically while adjusting their position too. It may be a bit more work.

Here is an example that is close, but in this case I didn't had to move, but the "hole" was animated and I wanted to have the rest static

https://github.com/ericoporto/dont-give-up-the-cat/blob/fc2810d9d580f6e1b51742489fa388fbd96cdbd0/dont-give-up-the-cat/room2.asc#L16

This is the main menu screen of Don't Give Up the Cat, where the cat that is rotating in 3D is the hole.

Joacim Andersson

Thank you, but I think I'll keep my approach.

SMF spam blocked by CleanTalk