def update(self): turtle.tiltangle(90) self.size = (-0.003)*(self.z) + 1.41 # y = mx + b, y=(-0.003)x + 1.41 turtle.shapesize(self.size*0.7,self.size) self.x = self.x + ((s.turnX) * (((-0.3)*(self.z) + 118)/10) * s.acc * 0.1); #more interpolation super().update()
def update(self): turtle.tiltangle(90) self.size = (-0.003) * ( self.z) + 1.41 # y = mx + b, y=(-0.003)x + 1.41 turtle.shapesize(self.size * 0.7, self.size) self.x = self.x + ((s.turnX) * (((-0.3) * (self.z) + 118) / 10) * s.acc * 0.1) #more interpolation super().update()
def update(self): turtle.tiltangle(90) turtle.shapesize(10,4) curTime = round(time.time() - s.time, 0) if(curTime == math.ceil(curTime) and curTime != self.prevTime): #prints time draw_score() if(GAMETIME - curTime <= 0): lose() self.prevTime = curTime super().update()
def update(self): turtle.tiltangle(90) turtle.shapesize(10, 4) curTime = round(time.time() - s.time, 0) if (curTime == math.ceil(curTime) and curTime != self.prevTime): #prints time draw_score() if (GAMETIME - curTime <= 0): lose() self.prevTime = curTime super().update()
def Arrow(txy, ax='X'): a = [0.1, 0, -0.1] b = [-0.1, 0.3, -0.1] tr.up() tr.goto(0, 0) tr.begin_poly() for i in range(2): tr.goto(a[i], b[i]) tr.end_poly() p = tr.get_poly() tr.register_shape("myArrow", p) tr.resizemode("myArrow") tr.shapesize(1, 2, 1) if ax == 'X': tr.tiltangle(0) tr.goto(txy[1] + 0.2, 0) pw = [int(txy[1]), -1.0] else: tr.tiltangle(90) tr.goto(0, txy[1] + 0.2) pw = [0.2, int(txy[1])] tr.stamp() tr.goto(pw) tr.write(ax, font=("Arial", 14, "bold"))
def Arrow(txy, ax='X'): a = [0.1, 0, -0.1] b = [-0.1, 0.3, -0.1] tr.up() tr.goto(0, 0) tr.begin_poly() for i in range(2): tr.goto(a[i], b[i]) tr.end_poly() # останавливаем запись p = tr.get_poly() # ссылка на многоугольник tr.register_shape("myArrow", p) tr.resizemode("myArrow") tr.shapesize(1, 2, 1) if (ax == 'X'): # для оси X tr.tiltangle(0) # угол для формы tr.goto(txy[1] + 0.2, 0) # к месту стрелки pw = [int(txy[1]), -1.0] # место для надписи else: # для оси Y else: tr.tiltangle(90) # новый угол для формы tr.goto(0, txy[1] + 0.2) # к месту стрелки pw = [0.2, int(txy[1])] # место для надписи tr.stamp() # оставить штамп - стрелка tr.goto(pw) # к месту надписи tr.write(ax, font=("Arial", 14, "bold"))
def __init__(self): self.dirx = 1.0 self.diry = 0.0 self.theta = 0 super().__init__(MYX, MYY, 0, -MYDELTA, MYSHAPE, MYCOLOR) turtle.tiltangle(0)
import turtle turtle.pen(fillcolor="white", pencolor="red", pensize=2) turtle.tiltangle(70) turtle.circle(20)
turtle.setup(window_width, window_height) turtle.listen(handle_click()) turtle.onscreenclick() def handle_click(x, y): print('detected a click at', x, y) # create a listener function which is called automatically on button def left_keypress(): print('left key detected') # in main function, declare left_keypress as the listener function turtle.listen() turtle.onkey(left_keypress, 'Left') turtle.register_shape('bird', ((-22, -39), (-20, -7), (-7, 3), (-11, 7), (-12, 9), (-11, 10), (-9, 10), (-3, 7), (10, 24), (30, 16), (13, 18), (4, 0), (14, -6), (6, -13), (0, -4), (-14, -13), (-22, -39))) turtle.shape('bird') turtle.tiltangle(new_tilt_value) main()
def left_keypress(): global new_tilt_value new_tilt_value = new_tilt_value + title_angle turtle.tiltangle(new_tilt_value) # change angle clockwise
def right_keypress(): global new_tilt_value new_tilt_value = new_tilt_value - title_angle turtle.tiltangle(new_tilt_value) # change angle anti-clockwise