So, I am trying to create a script that will check if an object is in a certain area and if it is, then create a variable which is assigned to every object in the area. My objects are 16X16 and they are centered origin. Here is my script
/*
Discription: Checks to see if an area is exists
Argument0: effect x
Argument1: effect y
*/
xcheck = argument0
ycheck = argument1
repeat(50)
{
while (place_meeting(xcheck,ycheck,obj_grass)=true) //while the check is on grass
{
xcheck-=16 //moves the check to the path to the left of the effect
}
xcheck-=16 //moves the check back to the grass
while (place_meeting(xcheck,ycheck,obj_grass)=true) // while the check is on grass
{
ycheck-=16 //moves the check up
}
ycheck+=16 //puts the check back on grass
//makes sure that the check reaches the top left corner of the area
}
repeat(50)
{
while (place_meeting(xcheck,ycheck,obj_grass)=true)
{
area=instance_position(xcheck,ycheck,obj_grass)
with (area) change=true
xcheck+=16
}
xcheck-=16
while (place_meeting(xcheck,ycheck,obj_grass)=true)
{
area=instance_position(xcheck,ycheck,obj_grass)
with (area) change=true
xcheck-=16
}
xcheck+=16
ycheck+=16
}
with (obj_grass)
{
if change=true
{
grassarea=1
}
}
When I run the debugger, xcheck=-767 and ycheck=1616.
Does anyone know how to reword the script?



Find content
Not Telling
