-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjivda_script.py
34 lines (27 loc) · 919 Bytes
/
jivda_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from random import randint
import pygame
class Jivdu(pygame.sprite.Sprite):
def __init__(self,type,animation_frame) -> None:
super().__init__()
if type == 'maakhi':
y = 200
self.type = type
elif type == 'gokalgaai':
y = 300
self.type = type
self.animation_frames = animation_frame
self.index = 0
self.image = self.animation_frames[self.index]
self.rect = self.image.get_rect(bottomleft=(randint(900,1200),y))
self.speed = 9
def animate(self):
self.index = (self.index + 0.2) % len(self.animation_frames)
self.image = self.animation_frames[int(self.index)]
def move(self):
self.rect.x -= self.speed
def destroy(self):
if self.rect.x <= -10 : self.kill()
def update(self):
self.animate()
self.move()
self.destroy()