-
Notifications
You must be signed in to change notification settings - Fork 0
/
meteor.py
42 lines (32 loc) · 846 Bytes
/
meteor.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
import pygame
class Meteor:
speed = 10
def __init__(self, x, screen):
self.screen = screen
self.x = x
self.y = 50
self.meteor_image = pygame.image.load('images/meteor.png')
self.screen.blit(self.meteor_image, (self.x, self.y))
def draw(self):
self.screen.blit(self.meteor_image, (self.x, self.y))
self.y += self.speed
def is_offscreen(self, screen_size):
return self.y > screen_size
# ACCESSORS!
# Accessors for x position
def getX(self):
"Returns the x position of the player."
return self.x
def setX(self, x):
"Sets the x position of the player."
self.x = x
# Accessors for y position
def getY(self):
"Returns the y position of the player."
return self.y
def setY(self, y):
"Sets the y position of the player."
self.y = y
# Accessors for the speed
def get_speed(self):
return self.speed