Bentley
Member
I was just wondering the following: if I put: place_meeting(x + i, y, obj_wall) as the expression in my for loop, is it then unnecessary to check if that wall exists?
For example, let's say I want to blow up every wall to my right:
Is this OK?
or do I need...
Thanks for the help.
For example, let's say I want to blow up every wall to my right:
Is this OK?
Code:
for (var i = 1; place_meeting(x + (i * 32), y, obj_wall); i += 1)
{
var wall = instance_place(x + (i * 32), y, obj_wall); //Is it garunteed this wall exists b/c of the check already done by the for loop?
instance_destroy(wall);
}
Code:
for (var i = 1; place_meeting(x + (i * 32), y, obj_wall); i += 1)
{
var wall = instance_place(x + (i * 32), y, obj_wall);
if (instance_exists(wall)) //I think this is redundant. Am I correct?
{
instance_destroy(wall);
}
}
Last edited: