Skip to content

Commit

Permalink
adjust timers demo
Browse files Browse the repository at this point in the history
  • Loading branch information
labuzm committed Dec 29, 2020
1 parent 7044099 commit 404bb08
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions demos/timers/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import math
import time
import random

from kaa.timers import Timer
Expand Down Expand Up @@ -33,16 +35,17 @@ def __init__(self):
self.spawn()

def spawn(self, context=None):
angles = list(range(0, 360, 10))
start = int(math.degrees(math.sin(time.time())))
angles = list(range(start, start + 360, 20))
for angle in angles:
self.space.add_child(
TtlNode(
mass=1e10,
sprite=self.python_image,
angular_velocity=1,
angular_velocity=2,
ttl=random.uniform(2, 6),
shape=Polygon.from_box(Vector(20, 20)),
velocity=Vector.from_angle_degrees(angle) * 50
velocity=Vector.from_angle_degrees(angle) * 60
)
)
if context:
Expand Down

0 comments on commit 404bb08

Please sign in to comment.