FlamingYeti
Member
Me again
I'm hoping by slowly learning techniques from you guys, I'll become a better programmer, than just sitting trying to work out a half-arsed slightly ****ty way of doing something.
The Concept
I'm making a top-down game. The idea is there will be a fog-of-war style roof, allowing you only to see the room you're in, and into rooms with windows, outisde etc. Currently I have a test-room with the inside of the walls covered with a tiling oRoof object, and the idea is that when you walk through the door, the alpha of the roof tiles fades to 0, and you can see everything in the room.
The reason I'd like it to be dynamic, instead of hard-coding the zones of each room is because if there's an explosion, or a change in the environment, or a wall-collapses, it'd be nice to have the player's vision almost spill out, so the game re-calculates the area you can see.
The Idea
Is there a way where every frame, or in a script or something, the game would detect 2 points, the two opposite corners of the room, then fade away the alpha of every roof tile between those points? Some kind of function, a calculation etc...
The Pseudocode
Thank you in advance for the help, you're all so lovely <3
The Concept
I'm making a top-down game. The idea is there will be a fog-of-war style roof, allowing you only to see the room you're in, and into rooms with windows, outisde etc. Currently I have a test-room with the inside of the walls covered with a tiling oRoof object, and the idea is that when you walk through the door, the alpha of the roof tiles fades to 0, and you can see everything in the room.
The reason I'd like it to be dynamic, instead of hard-coding the zones of each room is because if there's an explosion, or a change in the environment, or a wall-collapses, it'd be nice to have the player's vision almost spill out, so the game re-calculates the area you can see.
The Idea
Is there a way where every frame, or in a script or something, the game would detect 2 points, the two opposite corners of the room, then fade away the alpha of every roof tile between those points? Some kind of function, a calculation etc...
The Pseudocode
Code:
if x > CornerPoint1.x and x < CornerPoint2.x and y > CornerPoint1.y and x < CornerPoint2.y{
FadeAlpha
}