random shaking
This commit is contained in:
parent
22e85de73d
commit
1aeeb90da2
1 changed files with 3 additions and 2 deletions
|
|
@ -48,6 +48,7 @@ class TreeSprite:
|
|||
def shake(self):
|
||||
if self.shaking == 0:
|
||||
self.shaking = 10
|
||||
self.shaking_magnitude = random.randint(0, 10)
|
||||
self.leafs.extend(
|
||||
[
|
||||
Leaf(
|
||||
|
|
@ -59,7 +60,7 @@ class TreeSprite:
|
|||
),
|
||||
lifespan=1,
|
||||
)
|
||||
for i in range(2)
|
||||
for i in range(int(self.shaking_magnitude / 2))
|
||||
]
|
||||
)
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ class TreeSprite:
|
|||
if self.shaking == 0:
|
||||
return 0
|
||||
self.shaking -= 1
|
||||
return random.randint(-15, 15)
|
||||
return random.randint(-self.shaking_magnitude, self.shaking_magnitude)
|
||||
|
||||
@property
|
||||
def rect(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue