MCPcopy Create free account
hub / github.com/geekcomputers/Python / __init__

Method __init__

Street_Fighter/src/fighter.py:5–26  ·  view source on GitHub ↗
(self, player, x, y, flip, data, sprite_sheet, animation_steps, sound)

Source from the content-addressed store, hash-verified

3
4class Fighter:
5 def __init__(self, player, x, y, flip, data, sprite_sheet, animation_steps, sound):
6 self.player = player
7 self.size = data[0]
8 self.image_scale = data[1]
9 self.offset = data[2]
10 self.flip = flip
11 self.animation_list = self.load_images(sprite_sheet, animation_steps)
12 self.action = 0 # 0:idle #1:run #2:jump #3:attack1 #4: attack2 #5:hit #6:death
13 self.frame_index = 0
14 self.image = self.animation_list[self.action][self.frame_index]
15 self.update_time = pygame.time.get_ticks()
16 self.rect = pygame.Rect((x, y, 80, 180))
17 self.vel_y = 0
18 self.running = False
19 self.jump = False
20 self.attacking = False
21 self.attack_type = 0
22 self.attack_cooldown = 0
23 self.attack_sound = sound
24 self.hit = False
25 self.health = 100
26 self.alive = True
27
28 def load_images(self, sprite_sheet, animation_steps):
29 # extract images from spritesheet

Callers

nothing calls this directly

Calls 1

load_imagesMethod · 0.95

Tested by

no test coverage detected