если авто сталкивается с горизонтальной стеной то if speed>0
{
if point_direction(self.x,self.y,other.x,other.y)<90
{
direction+=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)>0
{
direction+=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)>90
{
direction-=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)<180
{
direction-=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)>180
{
direction+=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)<270
{
direction+=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)>270
{
direction-=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)<360
{
direction-=4
speed=speed/1.1
}
}
if speed<0
{
speed=+5
}
а если с вертикальной то
if speed>0
{
if point_direction(self.x,self.y,other.x,other.y)<90
{
direction+=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)>0
{
direction+=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)>90
{
direction-=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)<180
{
direction-=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)>180
{
direction+=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)<270
{
direction+=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)>270
{
direction-=4
speed=speed/1.1
}
if point_direction(self.x,self.y,other.x,other.y)<360
{
direction-=4
speed=speed/1.1
}
}
if speed<0
{
speed=+5
}