SHARE
TWEET

Untitled

a guest Jan 25th, 2020 87 in 150 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # coding: utf-8 -*-
  2. from graph import *
  3. from math import cos, sin, radians
  4.  
  5. """
  6. В поисках анимации
  7. """
  8.  
  9. def update():
  10.     for obj_id in ship1_list_id:
  11.         moveObjectBy(obj_id, 1, 0)
  12.    
  13.  
  14. def ship1(rad, center0, center1):
  15.     brushColor(164, 90, 82)
  16.     penSize(1)
  17.  
  18.     ship1_list_id = []
  19.     mylist = []
  20.     for i in range(91):
  21.         pointX = cos(radians(90+i)) * rad
  22.         pointY = sin(radians(90+i)) * rad
  23.         pointX, pointY = pointX + center0, pointY + center1
  24.         mylist.append((pointX, pointY))
  25.     mylist.append((center0, center1))
  26.     # Корма корабля
  27.     obj_id=polygon(mylist)
  28.     ship1_list_id.append(obj_id)
  29.     # Корпус корабля
  30.     obj_id=polygon([(center0, center1), (center0+rad*4, center1), (center0+rad*4, center1+rad), (center0, center1+rad),
  31.              (center0, center1)])
  32.     ship1_list_id.append(obj_id)
  33.     # Мыс корабля
  34.     obj_id=polygon([(center0 + rad*4, center1 + rad), (center0+rad*6.5, center1), (center0+rad*4, center1),
  35.              (center0 + rad*4, center1 + rad)])
  36.     ship1_list_id.append(obj_id)
  37.     # Мачта корабля
  38.     obj_id=polygon([(center0+rad*4 - rad*2-5, center1), (center0+rad*4 - rad*2-5, center1-rad*3),
  39.              (center0+rad*4 - rad*2+5, center1-rad*3), (center0+rad*4 - rad*2+5, center1)])
  40.     ship1_list_id.append(obj_id)
  41.     # Паруса корабля
  42.     brushColor(204, 197, 143)
  43.     obj_id=polygon([(center0+rad*4 - rad*2+5, center1), (center0+rad*5 - rad+5, center1-rad*1.5),
  44.              (center0+rad*4.5 - rad*2+5, center1-rad*1.5)])
  45.     ship1_list_id.append(obj_id)
  46.     obj_id=polygon([(center0+rad*4.5 - rad*2+5, center1-rad*1.5), (center0+rad*5 - rad+5, center1-rad*1.5),
  47.              (center0+rad*4 - rad*2+5, center1-rad*3)])
  48.     ship1_list_id.append(obj_id)
  49.     # Иллюминатор корабля
  50.     penSize(3)
  51.     obj_id=circle(center0+rad*4.5, center1+rad/2.5, rad/3.5)
  52.     ship1_list_id.append(obj_id)
  53.     return ship1_list_id
  54.  
  55. global rad, center0, center1, ship1_list_id
  56. rad, center0, center1 = 30, 100, 150
  57. ship1_list_id = ship1(rad, center0, center1)
  58.  
  59. onTimer(update, 50)
  60.  
  61. run()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top