Code clean 1

This commit is contained in:
9and3r
2014-07-25 16:36:31 +02:00
parent 7d76bb1feb
commit 8cd99fa2af
7 changed files with 191 additions and 233 deletions

View File

@@ -2,24 +2,26 @@ import random
class DynamicBackground():
def __init__(self):
self.current=[0,0,0]
self.target=[0,0,0]
for x in range(0, 3):
self.target[x]=random.randint(0,255)
def __init__(self):
self.current=[0,0,0]
for x in range(0, 3):
self.current[x]=random.randint(0,255)
self.target=[0,0,0]
for x in range(0, 3):
self.target[x]=random.randint(0,255)
def drawBackground(self,surface):
same = True
for x in range(0, 3):
if self.current[x]> self.target[x]:
self.current[x]=self.current[x]-1
elif self.current[x]<self.target[x]:
self.current[x]=self.current[x]+1
if(self.current != self.target):
same = False
if same:
for x in range(0, 3):
self.target[x]=random.randint(0,255)
surface.fill(self.current)
def drawBackground(self,surface):
same = True
for x in range(0, 3):
if self.current[x]> self.target[x]:
self.current[x]=self.current[x]-1
elif self.current[x]<self.target[x]:
self.current[x]=self.current[x]+1
if(self.current != self.target):
same = False
if same:
for x in range(0, 3):
self.target[x]=random.randint(0,255)
surface.fill(self.current)