This script is driving me crazy!!! I can't find what's wrong with it. It's supposed to find a nearest corner it comes by but for some reason it goes too far!
obj_enemy//create event
direction=270
speed=1
i=1
//collision event with obj_solid
speed=0
col_dir=direction
cos1=round(cos(degtorad(col_dir+90)))
cos2=round(cos(degtorad(col_dir)))
sin1=round(-sin(degtorad(col_dir+90)))
sin2=round(-sin(degtorad(col_dir)))
point[0,0]=x+sin1
point[0,1]=y+cos1
cor=false
while(cor=false)
{
checkx=point[0,0]+i*cos1+cos2
checky=point[0,1]+i*sin1+sin2
if !place_meeting(checkx,checky,obj_solid)
{
point[1,0]=checkx
point[1,1]=checky
cor=true
}
i+=1
}
show_message(string(point[1,0])+", "+string(point[1,1]))
Nearest corner… wait, what do you mean by that?
I made alot of nearest [insert thing here] scripts… could talk to you about the general way it's done…Why are you doing trig? Just get the room height and width
see where you arethen each corner would have a range.Nearest corner like in stucking your back on wall like on Counterstrike? Is that what you mean?
Please be more specific and it would be really good if you have a screenshot here to pinpoint the problem.what does nearest corner mean?
maybe changing