-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlock.py
More file actions
executable file
·39 lines (26 loc) · 842 Bytes
/
Block.py
File metadata and controls
executable file
·39 lines (26 loc) · 842 Bytes
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
import pygame
import math
import random
from GameObject import GameObject
class Block(GameObject):
@staticmethod
def init():
Block.image = pygame.image.load("images/gold-block.png").convert_alpha()
def __init__(self,x,y):
factor = 0.8
image = Block.image
w,h = image.get_size()
#print(w * factor)
image = pygame.transform.scale(image, (int(factor * w), int(factor * h)))
super(Block, self).__init__(x,y,image,30)
self.number = random.randint(0,20)
self.font = pygame.font.SysFont('Arial', 25)
pygame.display.set_caption('Box Test')
self.font.render('Hello!', True, (255,0,0)), (200, 100)
pygame.display.update()
# print(self.number)
def update(self, keysDown, screenWidth, screenHeight):
vx = 0
vy = self.downSpeed
self.velocity = (vx,vy)
super(Block,self).update(screenWidth,screenHeight)