-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsprites_load.py
96 lines (86 loc) · 3.51 KB
/
sprites_load.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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import pygame
import os
from constants import myfont, font2, ts, ANTIALIAS
chartable=list()
canim=tuple()
for i in range(6):
canim+=(pygame.image.load(os.path.join("graphics","cr"+str(i)+".png")),)
canim+=(pygame.image.load(os.path.join("graphics","cr.png")),)
bling=tuple()
for i in range(7):
bling+=(
pygame.image.load(os.path.join("graphics","bl"+str(i)+".png")),
)
turnip=tuple() #0 : droite. #1 : gauche
cbnasurf = pygame.image.load(os.path.join('graphics', 'cbna.png'))
#cbnasurf.convert(screen)
boostup = pygame.image.load(os.path.join('graphics', 'boostup.png'))
#boostup.convert_alpha(screen)
boostdown=pygame.transform.flip(boostup,False,True)
natural_boostup = pygame.image.load(os.path.join('graphics', 'boostup_nat.png'))
#boostup.convert_alpha(screen)
natural_boostdown=pygame.transform.flip(natural_boostup,False,True)
boostingsurf= pygame.image.load(os.path.join('graphics', 'bselect1b.png'))
#boostingsurf.convert_alpha(screen)
heartsurf= pygame.image.load(os.path.join("graphics", "heart.png"))
emptyheartsurf= pygame.image.load(os.path.join("graphics", "heart_empty.png"))
#heartsurf.convert_alpha(screen)
lifevial=pygame.image.load(os.path.join("graphics","heart.png"))
#lifevial.convert_alpha(screen)
starsurf=pygame.image.load(os.path.join("graphics", "star.png"))
#starsurf.convert_alpha(screen)
infinity=pygame.image.load(os.path.join("graphics", "infinity.png"))
#infinity.convert_alpha(screen)
boostnote=pygame.image.load(os.path.join("graphics", "boost_icon.png"))
#boostnote.convert_alpha(screen)
boost_socket=pygame.image.load(os.path.join("graphics", "boost_socket.png"))
boost_icon=pygame.image.load(os.path.join("graphics", "boost_icon.png"))
wall=pygame.image.load(os.path.join("graphics", "cr.png"))
cadre = pygame.image.load(os.path.join("graphics", "cadre.png"))
marker=pygame.image.load(os.path.join("graphics","marker.png"))
timer=pygame.image.load(os.path.join("graphics","timer.png"))
vial=pygame.image.load(os.path.join("graphics","heart_vial.png"))
#marker.convert_alpha(screen)
#from spt import FONTSIZE,myfont,font2
leveltitle=myfont.render("Level :", ANTIALIAS, (255,255,255))
scoretitle=myfont.render("Score :", ANTIALIAS, (255,255,255))
boosttitle=font2.render("Boost",ANTIALIAS,(255,255,255))
gradtile=pygame.Surface((ts,ts), pygame.SRCALPHA)
for j in range(ts):
for i in range(ts):
gradtile.set_at((i,j),(0,0,0,(j/ts)**1.5*260*(j%2)*(i%2)))
if not(j%2 or i%2):
gradtile.set_at((i,j),(255,255,255,(j/ts)**4*200))
#pygame.draw.line(gradtile, (0,0,0,128-i*128/ts), (0,i),(ts,i))
def reload_character():
datafile=open(os.path.join("levels","level0.rawdata"))
fat=(int(datafile.readline().strip())*(ts%11))
#print("fat=",fat)
datafile.close()
global chartable
global turnip
chartable=list()
for i in range(3):
chartable.append(pygame.image.load(os.path.join("graphics","character"+str(i+fat)+".png"))) #load character images
chartable=list((tuple(chartable),tuple()))
for img in chartable[0]: #flipped images
chartable[1]+=(pygame.transform.flip(img,True,False),)
turnip=tuple() #0 : droite. #1 : gauche
for d in range(2):
turnip+=(chartable[d][0],)
for i in range(3):
turnip+=(pygame.transform.rotate(turnip[-1],(d*2-1)*90),)
return chartable,turnip
reload_character()
"""
sprites["chartable"]=chartable
sprites["canim"]=canim
sprites["bling"]=bling
sprites["cbnasurf"]=cbnasurf
sprites["boostup"]=boostup
sprites["boostdown"]=boostdown
sprites["boostingsurf"]=boostingsurf
sprites["heartsurf"]=heartsurf
sprites["lifevial"]=lifevial
sprites["starsurf"]=starsurf
sprites["infinity"]=infinity"""