added different types of targets
This commit is contained in:
parent
a352c41651
commit
6715733162
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue