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