-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFireball.py
More file actions
36 lines (29 loc) · 1019 Bytes
/
Fireball.py
File metadata and controls
36 lines (29 loc) · 1019 Bytes
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
35
36
import pygame
from pygame.locals import *
import pyganim
class Fireball(object):
def __init__(self, x, y):
self.x = x
self.y = y
self.movingSpeed = 10 # in the x direction
self.movingDirection = "right"
self.rdata = "characterImages/fireBall.png"
self.ldata = "characterImages/fireBall_mirror.png"
self.ballRect = [(0*82, 0*83, 82, 83),
(1*82, 0*83, 82, 83),
(2*82, 0*83, 82, 83),
(3*82, 0*83, 82, 83)]
self.lballRect = [(3*82, 0*83, 82, 83),
(2*82, 0*83, 82, 83),
(1*82, 0*83, 82, 83),
(0*82, 0*83, 82, 83)]
def ball(self):
fireBall = pyganim.getImagesFromSpriteSheet(self.rdata, rects = self.ballRect)
ballFrame = list(zip(fireBall, [100] * len(fireBall)))
ballAnim = pyganim.PygAnimation(ballFrame)
return ballAnim
def lball(self):
lfireBall = pyganim.getImagesFromSpriteSheet(self.ldata, rects = self.lballRect)
lballFrame = list(zip(lfireBall, [100] * len(lfireBall)))
lballAnim = pyganim.PygAnimation(lballFrame)
return lballAnim