def AI(self,plx,ply): #traslates
angle1 = atan2(ply - self.y1,plx - self.x1)
self.x1 = cos(angle1) * self.speed + self.x1
self.y1 = sin(angle1) * self.speed + self.y1
self.x2 = cos(angle1) * self.speed + self.x2
self.y2 = sin(angle1) * self.speed + self.y2
self.x3 = cos(angle1) * self.speed + self.x3
self.y3 = sin(angle1) * self.speed + self.y3
self.x4 = cos(angle1) * self.speed + self.x4
self.y4 = sin(angle1) * self.speed + self.y4
def show(self):
stroke(0)
strokeWeight(1)
fill(255,0,0)
beginShape()
vertex(self.x1,self.y1)
vertex(self.x2,self.y2)
vertex (self.x3,self.y3)
vertex(self.x4,self.y4)
endShape()
#ellipse(self.x,self.y,self.r,self.r)
I need to rotate the first vertex of this quad (the same above) towards the player:
beginShape()
vertex(40,40)
vertex(50,60)
vertex (20,30)
vertex(70,40)
endShape()
I tried with rotate(), but actually it rotates all of the things in my scene (it was funny at least)
(Im sure that I am missing some moving objects on a plain foundamentals too, bc actaully I am at 11th grade and I have never done this kind of things at school)