Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- import time
- win = True
- YELLOW = (255, 255, 224)
- BLACK = (0, 0, 0)
- pygame.init()
- # create screen
- screen_width = 1920
- screen_height = 1080
- screen = pygame.display.set_mode([screen_width, screen_height])
- pygame.display.set_caption('Course Work :)')
- clock = pygame.time.Clock()
- knots = int(140)
- rotate = int()
- previousspeed = int(1)
- pitch = int(60)
- class Plane(pygame.sprite.Sprite):
- def __init__(self):
- pygame.sprite.Sprite.__init__(self)
- self.rect = pygame.Rect(0, 0, 0, 0)
- self.image = pygame.image.load("D:\Display.PNG")
- class pointer(pygame.sprite.Sprite):
- def __init__(self,x,y,width,height):
- pygame.sprite.Sprite.__init__(self)
- self.rect = pygame.Rect(width, height, x, y)
- self.image = pygame.image.load("D:\\Needle.PNG")
- class needle(pygame.sprite.Sprite):
- def __init__(self, color, width, height):
- pygame.sprite.Sprite.__init__(self)
- self.image = pygame.Surface([width, height])
- pygame.draw.rect(self.image, color, [0, 0, width, height])
- self.rect = self.image.get_rect()
- self.original = self.image
- all_sprites_list = pygame.sprite.Group()
- plane = Plane()
- speed = pointer(1,1,-54,113)
- all_sprites_list.add(plane)
- all_sprites_list.add(speed)
- attitude = needle(YELLOW, 80, 4)
- attitude.rect.y = 227
- attitude.rect.x = 168
- all_sprites_list.add(attitude)
- rotcomplete = bool(False)
- while win == True:
- if rotate == previousspeed:
- pass
- else:
- speed.image = pygame.transform.rotate(speed.image, -rotate)
- rotate = 360 - ( knots * 1.8)
- speed.image = pygame.transform.rotate(speed.image, rotate)
- previousspeed = rotate
- clock.tick(100)
- all_sprites_list.draw(screen)
- all_sprites_list.update()
- pygame.display.update()
- time.sleep(1)
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement