Merge branch 'master' of github.com:lvl2/avocados
commit
61ffeb267a
|
@ -80,10 +80,14 @@ class Avocado:
|
|||
return self.has_been_pinned
|
||||
|
||||
|
||||
def checkBoundaries(self):
|
||||
if self.rect.right > self.screen_width or self.rect.left < 0:
|
||||
self.vx = -self.vx
|
||||
|
||||
|
||||
def move(self):
|
||||
if not self.has_been_pinned:
|
||||
if self.rect.right > self.screen_width or self.rect.left < 0:
|
||||
self.vx = -self.vy
|
||||
self.checkBoundaries()
|
||||
|
||||
if self.hasLanded():
|
||||
self.destroy()
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import pygame
|
||||
from support.colors import *
|
||||
|
||||
class Text:
|
||||
|
||||
def __init__(self, container, text, pos, duration):
|
||||
""" Foo """
|
||||
self.clock = container['clock']
|
||||
self.duration = duration
|
||||
self.totalTime = 0
|
||||
self.text = container['font'].render(text, 0 , WHITE)
|
||||
self.screen = container['screen']
|
||||
self.pos = pos
|
||||
|
||||
|
||||
def blitme(self):
|
||||
""" sd """
|
||||
self.screen.blit(self.text, self.pos)
|
||||
|
||||
|
||||
def hasExpired(self):
|
||||
self.totalTime += self.clock.get_time()
|
||||
if self.totalTime > self.duration:
|
||||
del(self)
|
||||
return True
|
||||
return False
|
Loading…
Reference in New Issue