Browse Source

improved shape generation, added random to bounceoff

master
Fr3deric 7 years ago
parent
commit
2073a3e277
  1. 8
      generators/unrath.py

8
generators/unrath.py

@ -36,7 +36,11 @@ class Unrath: @@ -36,7 +36,11 @@ class Unrath:
shapesize = random.randint(2, 5)
while len(self.shape) < shapesize:
p = random.sample(self.shape, 1)[0]
self.shape.add((p[0]+random.randint(0, 1), p[1]+random.randint(0, 1)))
self.shape.add((p[0]+random.randint(-1, 1),
p[1]+random.randint(-1, 1)))
minx = min(map(lambda p: p[0], self.shape))
miny = min(map(lambda p: p[1], self.shape))
self.shape = {(p[0]+abs(minx), p[1]+abs(miny)) for p in self.shape}
self.shapewidth = max(map(lambda p: p[0], self.shape))
shapeheight = max(map(lambda p: p[1], self.shape))
@ -69,7 +73,7 @@ class Unrath: @@ -69,7 +73,7 @@ class Unrath:
else:
slow = unrath
fast = self
slow.speed = fast.speed * 1.1
slow.speed = fast.speed * (1.1 + random.random()/10)
slow.update(dt, True)
if not collision:
self.pos = newpos

Loading…
Cancel
Save