enabled tap to test
This commit is contained in:
parent
4442bed2c2
commit
36ca8638f6
@ -20,24 +20,27 @@ class Dial(pygame.sprite.Sprite):
|
||||
self.image = pygame.transform.rotate(self._base_image, self.rotation)
|
||||
self.rect = self._base_image.get_rect()
|
||||
self.test_cw = True
|
||||
self.test = True
|
||||
|
||||
def update(self):
|
||||
if self.test_cw:
|
||||
self.position += 0.01
|
||||
else:
|
||||
self.position -= 0.01
|
||||
if self.position > 1:
|
||||
self.position = 1
|
||||
self.test_cw = not self.test_cw
|
||||
if self.position < 0:
|
||||
self.position = 0
|
||||
self.test_cw = not self.test_cw
|
||||
if self.test:
|
||||
if self.test_cw:
|
||||
self.position += 0.01
|
||||
else:
|
||||
self.position -= 0.01
|
||||
if self.position > 1:
|
||||
self.position = 1
|
||||
self.test_cw = not self.test_cw
|
||||
if self.position < 0:
|
||||
self.position = 0
|
||||
self.test_cw = not self.test_cw
|
||||
self.rotation = 77 - (2 * 77.5 * self.position)
|
||||
self.image = pygame.transform.rotate(self._base_image, self.rotation)
|
||||
self.rect = self.image.get_rect(center=self.rect.center)
|
||||
self.rect.center = (math.sin(math.radians(self.rotation)) * -300 + 360,
|
||||
math.cos(math.radians(self.rotation + 180)) * 300 + 360)
|
||||
|
||||
def set_test(self, test_value):
|
||||
self.test = test_value
|
||||
|
||||
def main(windowed_mode):
|
||||
pygame.init()
|
||||
@ -74,6 +77,11 @@ def main(windowed_mode):
|
||||
if event.type == pygame.KEYDOWN:
|
||||
if event.key == pygame.K_ESCAPE:
|
||||
running = False
|
||||
if event.type == pygame.MOUSEBUTTONDOWN:
|
||||
dial.set_test(True)
|
||||
if event.type == pygame.MOUSEBUTTONUP:
|
||||
dial.set_test(False)
|
||||
|
||||
|
||||
mouse_pos = pygame.mouse.get_pos()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user