def motion(self, event): self.event_motion = event try: s = fast_tanh(event.x, event.y, self.length) x = s // 10000 y = s % 1000 canvas.coords(self.gun, 0, 250, x, y) except: pass
def scale_up(self): canvas.itemconfig(self.gun, fill='#' + self.color) self.length += 0.3 try: s = fast_tanh(self.event_motion.x, self.event_motion.y, self.length) x = s // 10000 y = s % 1000 canvas.coords(self.gun, 0, 250, x, y) except: pass self.loop = root.after(5, self.scale_up)
def cancel_scale_up(self): root.after_cancel(self.loop) canvas.itemconfig(self.gun, fill='#000') try: s = fast_tanh(self.event_motion.x, self.event_motion.y, self.length) x = s // 10000 y = s % 1000 canvas.coords(self.gun, 0, 250, x, y) except: pass if self.end_game_position == 0: self.bullets.append(Bullet(x, y, self.length)) self.bullet_amount += 1 self.create_random_color() self.length = 100 try: s = fast_tanh(self.event_motion.x, self.event_motion.y, self.length) x = s // 10000 y = s % 1000 canvas.coords(self.gun, 0, 250, x, y) except: pass
from computation import fast_tanh x1 = 571.5 y1 = 361.1 length = 103.5 tg = (250 - y1) / x1 print('afsdd') x = (length**2 / (1 + tg**2))**0.5 y = tg * x print(x, y) print(fast_tanh(x1, y1, length))