Added missing fileg

master
David Raison 2014-08-31 10:20:12 +02:00
parent 1a32547801
commit 633be6c6c0
2 changed files with 34 additions and 2 deletions

View File

@ -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()

28
itext.py Normal file
View File

@ -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