-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbleach1.1
82 lines (69 loc) · 2.23 KB
/
bleach1.1
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import math, random, sys
import pygame as pyg
from pyg.locals import *
#DEFINIÇÃO DA TELA
def events():
for event in pyg.event.get():
if event.type == QUIT or (event.type == KEYDOWN and event.key == K_SCAOE):
PYGAME.QUIT()
SYS.EXIT()
#Definição da tela
L, H = 1920, 1080
HL, HH = L/2, H/2
AREA = L * H
#iniciando a tela
pyg.init()
relogio = pyg.time.Clock()
tela = pyg.display.set_mode((L, H))
pyg.display.set_caption("Bleach Inicio")
FPS = 1
#cores
preto = (0,0,0, 255)
branco = (255, 255, 255, 255)
class spritesheet:
def __init__(self, filename, cols, rows):
self.sheet = pyg.image.load("1Ichigo Kurosaki.png")
self.cols = cols
self.rows = rows
self.totalCellCout = cols * rows
self.rect = self.sheet.get_rect()
l = self.cellWidth =self.rect.width / cols
h = self.cellHeight =self.rect.height / rows
hl, hh = self.cellCenter = (l/2,h/2)
self.cells = list([(index % cols * l, index / cols * h, l, h) for index in range(self.totalCellCount)])
self.handle = list([
(0,0),(-hl,0), (-l,0),
(0,-hh),(-hl,-hh),(-l,-hh),
(0,-h),(-hl,-h),(-l,-h)])
def draw(self, sufarce, cellindex, x, y, handle = 0):
sufarce.blit(self.sheet, (x + self.handle[handle][0], y + self.handle[handle][1], self.cells[cellindex])
s = pyg.image.open("1Ichigo Kurosaki.png", 2,0)
CENTER_HANDLE = 4
index = 0
s.convert()
rect = s.get_rect()
rect.center = w//2, h//2
moving =False
while running:
for eventinpygame.event.get():
if event.type == QUIT:
running =False
elif event.type == MOUSEBUTTONDOWN:
if rect.collidepoint(event.pos):
moving = True
elif event.type == MOUSEBUTTONUP:
moving = False
elif event.type == MOUSEMOTION and moving:
rect.move_ip(event.rel)
screen.fill(branco)
screen.blit(s, rect)
pyg.draw.rect(screen, preto, rect, 1)
while True:
events()
s.draw(DS, index % s.totalCellCout, HL, HH, CENTER_HANDLE)
index +=1
pyg.draw.rect(DS, branco, (HL, HH),2,0)
pyg.display.update()
CLOCK.tick(FPS)
DS.fill(preto)
pyg.quit()