1
Fork 0

added different types of targets

This commit is contained in:
Jake Howard 2015-05-07 19:50:57 +01:00
parent a352c41651
commit 6715733162

View file

@ -1,5 +1,6 @@
import pygame import pygame
class Target(pygame.sprite.Sprite): class Target(pygame.sprite.Sprite):
def __init__(self, x, y, color=(30,0,150), width=16, height=16): def __init__(self, x, y, color=(30,0,150), width=16, height=16):
super().__init__() super().__init__()
@ -10,6 +11,7 @@ class Target(pygame.sprite.Sprite):
self.rect = self.image.get_rect() self.rect = self.image.get_rect()
self.speed = 10 self.speed = 10
self.rect.x, self.rect.y = (x+(self.width/2)),(y+(self.width/2)) # centres co-ordinates self.rect.x, self.rect.y = (x+(self.width/2)),(y+(self.width/2)) # centres co-ordinates
self.type = "NORMAL"
def move(self): def move(self):
self.rect.x += self.speed self.rect.x += self.speed
@ -17,3 +19,5 @@ class Target(pygame.sprite.Sprite):
def drop(self): def drop(self):
self.rect.y += 20 self.rect.y += 20
self.speed *= -1 self.speed *= -1