-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnumbers.py
executable file
·52 lines (36 loc) · 994 Bytes
/
numbers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import pygame
from pygame.locals import *
from sys import exit
import os.path as osp
class Numbers(pygame.sprite.Sprite):
def __init__(self, screen, number_image, value, in_motion):
pygame.sprite.Sprite.__init__(self)
self.image = number_image
self.rect = number_image.get_rect()
self.value = value
self.rect.y = 80
self.rect.x = 0
self.in_motion = in_motion
# Returns the value of the number
def getValue(self):
return self.value
# Sets the X Position of the number when Movement is called
def setXPosition(self, x_position):
self.rect.x = x_position
# Returns the x position
def XPosition(self):
return self.rect.x
# Returns the y position
def YPosition(self):
return self.rect.y
def reset(self):
self.rect.y = 80
def getImage(self):
return self.rect
def toggle(self):
self.in_motion = True if False else False
def moving(self):
return self.in_motion
# Initializes the movement of the number
def update(self):
self.rect.y += 1