add tip list
This commit is contained in:
parent
7b9d7734ab
commit
c733cf64e1
12 changed files with 598 additions and 187 deletions
23
tapwater.py
Normal file
23
tapwater.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import pygame
|
||||
from settings import PLAYER_SIZE, WATER_SIZE, WATER_SPEED
|
||||
|
||||
class TapWater:
|
||||
def __init__(self, x, y, direction):
|
||||
self.x = x + PLAYER_SIZE // 2 - WATER_SIZE // 2
|
||||
self.y = y + PLAYER_SIZE // 2 - WATER_SIZE // 2
|
||||
self.direction = direction
|
||||
self.rect = pygame.Rect(self.x, self.y, WATER_SIZE, WATER_SIZE)
|
||||
|
||||
def move(self):
|
||||
if self.direction == "up":
|
||||
self.y -= WATER_SPEED
|
||||
elif self.direction == "down":
|
||||
self.y += WATER_SPEED
|
||||
elif self.direction == "left":
|
||||
self.x -= WATER_SPEED
|
||||
elif self.direction == "right":
|
||||
self.x += WATER_SPEED
|
||||
self.rect.topleft = (self.x, self.y)
|
||||
|
||||
def draw(self, win, ox, oy):
|
||||
pygame.draw.rect(win, (0, 180, 255), (self.x - ox, self.y - oy, WATER_SIZE, WATER_SIZE))
|
||||
Loading…
Add table
Add a link
Reference in a new issue