from Id import *
import random
from helper import Helper as hlp

class Vaisseau():
    def __init__(self,nom,x,y):
        self.id=Id.prochainid()
        self.proprietaire=nom
        self.x=x
        self.y=y
        self.cargo=0
        self.energie=100
        self.vitesse=2
        self.cible=None 
        
    def avancer(self):
        if self.cible:
            x=self.cible.x
            y=self.cible.y
            ang=hlp.calcAngle(self.x,self.y,x,y)
            x1,y1=hlp.getAngledPoint(ang,self.vitesse,self.x,self.y)
            self.x,self.y=x1,y1 #int(x1),int(y1)
            if hlp.calcDistance(self.x,self.y,x,y) <=self.vitesse:
                self.cible=None
                #print("Change cible")
        else:
            print("PAS DE CIBLE")
    
    def avancer1(self):
        if self.cible:
            x=self.cible.x
            if self.x>x:
                self.x-=self.vitesse
            elif self.x<x:
                self.x+=self.vitesse
            
            y=self.cible.y
            if self.y>y:
                self.y-=self.vitesse
            elif self.y<y:
                self.y+=self.vitesse
            if abs(self.x-x)<(2*self.cible.taille) and abs(self.y-y)<(2*self.cible.taille):
                self.cible=None
d7627fbc6f0c4cd1faac9356d2fbb36def84b3d1
<mask token>

<mask token>


class Vaisseau:

    def __init__(self, nom, x, y):
        self.id = Id.prochainid()
        self.proprietaire = nom
        self.x = x
        self.y = y
        self.cargo = 0
        self.energie = 100
        self.vitesse = 2
        self.cible = None
    <mask token>

    def avancer1(self):
        if self.cible:
            x = self.cible.x
            if self.x > x:
                self.x -= self.vitesse
            elif self.x < x:
                self.x += self.vitesse
            y = self.cible.y
            if self.y > y:
                self.y -= self.vitesse
            elif self.y < y:
                self.y += self.vitesse
            if abs(self.x - x) < 2 * self.cible.taille and abs(self.y - y
                ) < 2 * self.cible.taille:
                self.cible = None

<mask token>


class Vaisseau:

    def __init__(self, nom, x, y):
        self.id = Id.prochainid()
        self.proprietaire = nom
        self.x = x
        self.y = y
        self.cargo = 0
        self.energie = 100
        self.vitesse = 2
        self.cible = None

    def avancer(self):
        if self.cible:
            x = self.cible.x
            y = self.cible.y
            ang = hlp.calcAngle(self.x, self.y, x, y)
            x1, y1 = hlp.getAngledPoint(ang, self.vitesse, self.x, self.y)
            self.x, self.y = x1, y1
            if hlp.calcDistance(self.x, self.y, x, y) <= self.vitesse:
                self.cible = None
        else:
            print('PAS DE CIBLE')

    def avancer1(self):
        if self.cible:
            x = self.cible.x
            if self.x > x:
                self.x -= self.vitesse
            elif self.x < x:
                self.x += self.vitesse
            y = self.cible.y
            if self.y > y:
                self.y -= self.vitesse
            elif self.y < y:
                self.y += self.vitesse
            if abs(self.x - x) < 2 * self.cible.taille and abs(self.y - y
                ) < 2 * self.cible.taille:
                self.cible = None

from Id import *
import random
from helper import Helper as hlp


class Vaisseau:

    def __init__(self, nom, x, y):
        self.id = Id.prochainid()
        self.proprietaire = nom
        self.x = x
        self.y = y
        self.cargo = 0
        self.energie = 100
        self.vitesse = 2
        self.cible = None

    def avancer(self):
        if self.cible:
            x = self.cible.x
            y = self.cible.y
            ang = hlp.calcAngle(self.x, self.y, x, y)
            x1, y1 = hlp.getAngledPoint(ang, self.vitesse, self.x, self.y)
            self.x, self.y = x1, y1
            if hlp.calcDistance(self.x, self.y, x, y) <= self.vitesse:
                self.cible = None
        else:
            print('PAS DE CIBLE')

    def avancer1(self):
        if self.cible:
            x = self.cible.x
            if self.x > x:
                self.x -= self.vitesse
            elif self.x < x:
                self.x += self.vitesse
            y = self.cible.y
            if self.y > y:
                self.y -= self.vitesse
            elif self.y < y:
                self.y += self.vitesse
            if abs(self.x - x) < 2 * self.cible.taille and abs(self.y - y
                ) < 2 * self.cible.taille:
                self.cible = None

from Id import *
import random
from helper import Helper as hlp

class Vaisseau():
    def __init__(self,nom,x,y):
        self.id=Id.prochainid()
        self.proprietaire=nom
        self.x=x
        self.y=y
        self.cargo=0
        self.energie=100
        self.vitesse=2
        self.cible=None 
        
    def avancer(self):
        if self.cible:
            x=self.cible.x
            y=self.cible.y
            ang=hlp.calcAngle(self.x,self.y,x,y)
            x1,y1=hlp.getAngledPoint(ang,self.vitesse,self.x,self.y)
            self.x,self.y=x1,y1 #int(x1),int(y1)
            if hlp.calcDistance(self.x,self.y,x,y) <=self.vitesse:
                self.cible=None
                #print("Change cible")
        else:
            print("PAS DE CIBLE")
    
    def avancer1(self):
        if self.cible:
            x=self.cible.x
            if self.x>x:
                self.x-=self.vitesse
            elif self.x<x:
                self.x+=self.vitesse
            
            y=self.cible.y
            if self.y>y:
                self.y-=self.vitesse
            elif self.y<y:
                self.y+=self.vitesse
            if abs(self.x-x)<(2*self.cible.taille) and abs(self.y-y)<(2*self.cible.taille):
                self.cible=None