Rexzqy
Member
Hello everybody,
I am trying to deactivate objects for better performance. For objects without code it went pretty smoothly:
(this is in an alarm that fires every 30 steps)
However, I am not sure how or even if I should deactivate those with codes. Should I deactivate them by:
and then record the ID and the deactivated time of it in a grid? Will that help the performance or worsen it? Any help or advice is greatly appreaciated!
EDIT: examples of objects with code includes seeds, which will grow into plants after a while. When I activate it again, I will add the amount of time since deactivation to the timer for growth. I am just wondering if this will actually help the performance or worsen it since it takes a grid and an addition alarm for every objects that need to be deactivated.
I am trying to deactivate objects for better performance. For objects without code it went pretty smoothly:
(this is in an alarm that fires every 30 steps)
Code:
for(var i = 0; i < array_length(deactivate_nocode_list); i++)
{
instance_deactivate_object(deactivate_nocode_list[i]);
}
instance_activate_region(obj_player.x-550,obj_player.y-300,obj_player.x+500,obj_player.y+300,true);
GML:
if point_in_rectangle(x,y,obj_player.x-550,obj_player.y-300,obj_player.x+550,obj_player.y+300) = false
{
instance_deactivate_object(id);
}
EDIT: examples of objects with code includes seeds, which will grow into plants after a while. When I activate it again, I will add the amount of time since deactivation to the timer for growth. I am just wondering if this will actually help the performance or worsen it since it takes a grid and an addition alarm for every objects that need to be deactivated.
Last edited: