1 # Copyright (c) 2011-2020 Philip Pavlick
3 # <swashdev@pm.me> wrote this file. Feel free to do whatever you want
4 # with it so long as you don't hold me liable for any damages; there is no
5 # warranty. In exchange, if you ever find yourself thinking "I can't do
6 # this," or "I'll never be that good," I want you to stop, take a deep breath,
7 # and say "Yes I can." Then prove you can. Don't prove it to me; don't prove
8 # it to your friends and family; don't prove it to your boss; prove it to
9 # yourself. This software is already free; now free yourself.
12 # For more information about the rationale behind this licensing, see
13 # https://www.pavlick.net/fyl/
15 # Functions for loading images for Orange Guy's Quest
16 from pygame
import image
18 SPRITES
= { "player":None,"key":None,"key2":None,"door":None,"spike":None, \
19 "rat":None,"ratking":None,"exit":None,"end":None,"dead":None, \
20 "won":None,"goblin":None,"ghost":None,"skull":None,"bat":None \
23 # Returns a pygame image
24 def get_sprite( key
, d
= '/', DEBUG
= False ):
26 if SPRITES
[key
] != None:
30 print "Load: " + key
+ " sprite"
31 SPRITES
[key
] = image
.load( get_image_link( key
, d
) )
33 print "Work: Converting " + key
+ " sprite"
35 SPRITES
[key
].set_colorkey( (255, 255, 255) )
37 SPRITES
[key
].set_colorkey( (255, 128, 255) )
38 SPRITES
[key
].convert_alpha()
41 def get_image_link( key
, d
):
44 return il
+ "maincharsprite.png"
46 return il
+ "keynew.png"
48 return il
+ "keyRednew.png"
50 return il
+ "door.png"
52 return il
+ "spike.png"
54 return il
+ "giantRat.png"
56 return il
+ "ratking.png"
60 return il
+ "lvlExit.png"
64 return il
+ "dead.png"
66 return il
+ "maincharend.png"
68 return il
+ "goblin.png"
70 return il
+ "dimensionalSpirit.png"
72 return il
+ "possessedSkull.png"