flyinian
Member
Declaring a local variable once and using it multiple times throughout the same event for entirely different things....Could this cause bugs and such?
Example:
My guess is that using the local variable like this is a recipe for disaster. Which is probably why my code isn't working as intended anymore.
The local variable "house" would need to be the same value throughout the entirety of the event to avoid unwanted outcomes, right?
Example:
GML:
if(something)
{
var house;
house = object1;
//code that uses the new value of "house".
};
/// Lots of other code not using local variable "house".
if(something entirely different)
{
house = ds_grid_get(something, 1,1);
//code that uses the new value of "house".
}
/// Lots of other code not using local variable "house".
if(something totally different)
{
house = 32;
//code that uses the new value of "house".
}
My guess is that using the local variable like this is a recipe for disaster. Which is probably why my code isn't working as intended anymore.
The local variable "house" would need to be the same value throughout the entirety of the event to avoid unwanted outcomes, right?