Пример #1
0
 def __init__(self):
     load_image = rgl.util.load_image
     self.oldman1 = spritesheet("data/lawn-mower.png", (96, 96))
     self.bubbman1 = spritesheet("data/bubbman.png", (24, 26))[1:][:2]
     self.oldman2 = spritesheet("data/oldman.png", (24, 26))
     self.bubbman2 = spritesheet("data/lawn-mower2.png", (96, 96))
     self.ground = spritesheet("data/grass-2.png", (24, 24))[1]
     self.fg = load_image("data/hills-front-1.png")
     self.fg2 = load_image("data/hills-back.png")
     self.bg = load_image("data/background-2.png")
     self.font_white = rgl.font.Font(NES_FONT, (255, 255, 255))
     self.font_black = rgl.font.Font(NES_FONT, (1, 1, 1))
     self.frame = 0
     self.pos = 0
     self.bubbmanpos = -128
     self.oldmanpos = -256
     self.ochasing = True
     self.transitioning = True
     self.shake = 0
     self.credits = [
         "Created by", "pymike", "", "", "", "Music by", "Operation D", "",
         "", "", "Sounds mixed with", "SFXR by DrPetter", "", "", "",
         "Graphics created with", "The Gimp 2", "", "", "", "Programmed in",
         "the python language"
         "", "", "", "Graphics library", "pygame and retrogamelib", "", "",
         "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
         "Thanks for playing!!"
     ]
Пример #2
0
 def __init__(self):
     load_image = rgl.util.load_image
     self.icon = spritesheet("data/bubbman.png", (24, 26))[0]
     self.font_white = rgl.font.Font(NES_FONT, (255, 255, 255))
     self.font_black = rgl.font.Font(NES_FONT, (1, 1, 1))
     self.spots = []
     self.w_levels = 8
     self.dist = 256 / self.w_levels
     for i in range(self.w_levels):
         self.spots.append([i * self.dist + 6, 166])
     self.spot_imgs = [
         load_image("data/spot-1.png"),
         load_image("data/spot-2.png")
     ]
     self.map = load_image("data/worldmap.png")
     self.logo = load_image("data/world-logo.png")
     self.frame = 0
     if not os.path.exists("prog.sav"):
         self.unlocked = 1
         open("prog.sav", "wb").write(str(self.unlocked))
     else:
         self.unlocked = int(open("prog.sav", "rU").read())
     self.num_levels = 0
     for i in range(8):
         if os.path.exists("data/level%d.png" % (i + 1)):
             self.num_levels += 1
         else:
             break
     self.pos = self.unlocked - 1
     if self.unlocked > 1:
         self.first_time = False
     else:
         self.first_time = True
Пример #3
0
 def __init__(self):
     load_image = rgl.util.load_image
     self.icon = spritesheet("data/bubbman.png", (24, 26))[0]
     self.font_white = rgl.font.Font(NES_FONT, (255, 255, 255))
     self.font_black = rgl.font.Font(NES_FONT, (1, 1, 1))
     self.spots = []
     self.w_levels = 8
     self.dist = 256/self.w_levels
     for i in range(self.w_levels):
         self.spots.append([i*self.dist + 6, 166])
     self.spot_imgs = [
         load_image("data/spot-1.png"), 
         load_image("data/spot-2.png")]
     self.map = load_image("data/worldmap.png")
     self.logo = load_image("data/world-logo.png")
     self.frame = 0
     if not os.path.exists("data/prog.sav"):
         self.unlocked = 1
         open("data/prog.sav", "wb").write(str(self.unlocked))
     else:
         self.unlocked = int(open("data/prog.sav", "rU").read())
     self.num_levels = 0
     for i in range(8):
         if os.path.exists("data/level%d.png" % (i+1)):
             self.num_levels += 1
         else:
             break
     self.pos = self.unlocked-1
     if self.unlocked > 1:
         self.first_time = False
     else:
         self.first_time = True
Пример #4
0
 def __init__(self):
     load_image = rgl.util.load_image
     self.oldman1 = spritesheet("data/lawn-mower.png", (96, 96))
     self.bubbman1 = spritesheet("data/bubbman.png", (24, 26))[:3]
     self.bubbman2 = flip_images(self.bubbman1)
     self.ground = spritesheet("data/grass-2.png", (24, 24))[1]
     self.fg = load_image("data/hills-front-1.png")
     self.fg2 = load_image("data/hills-back.png")
     self.bg = load_image("data/background-1.png")
     self.font_white = rgl.font.Font(NES_FONT, (255, 255, 255))
     self.font_black = rgl.font.Font(NES_FONT, (1, 1, 1))
     self.frame = 0
     self.pos = 0
     self.bpos = [200, 240 - 26 - 20]
     self.opos = [0, 240 - 96 - 20]
     self.ochasing = True
     self.run_away = False
     self.stopped = None
     self.boom = rgl.util.play_sound("data/motor.ogg", 0.5)
     self.boom.stop()
Пример #5
0
 def __init__(self):
     load_image = rgl.util.load_image
     self.oldman1 = spritesheet("data/lawn-mower.png", (96, 96))
     self.bubbman1 = spritesheet("data/bubbman.png", (24, 26))[:3]
     self.bubbman2 = flip_images(self.bubbman1)
     self.ground = spritesheet("data/grass-2.png", (24, 24))[1]
     self.fg = load_image("data/hills-front-1.png")
     self.fg2 = load_image("data/hills-back.png")
     self.bg = load_image("data/background-1.png")
     self.font_white = rgl.font.Font(NES_FONT, (255, 255, 255))
     self.font_black = rgl.font.Font(NES_FONT, (1, 1, 1))
     self.frame = 0
     self.pos = 0
     self.bpos = [200, 240-26-20]
     self.opos = [0, 240-96-20]
     self.ochasing = True
     self.run_away = False
     self.stopped = None
     self.boom = rgl.util.play_sound("data/motor.ogg", 0.5)
     self.boom.stop()
Пример #6
0
    def loadLevel(self, level):
        print("level loading")
        levelfile = open(self.levelDir + "/" + self.levelList[level])
        levelDict = json.load(levelfile)
        levelfile.close()

        self.assetsDir = levelDict[
            "assetsDir"] if "assetsDir" in levelDict else "assets\\"
        self.spriteSheet = objs.spritesheet(
            levelDict["sprite sheet"]
        ) if "sprite sheet" in levelDict else None  #check for a sprite sheet otherwise none
        self.physics = levelDict["physics"] if "physics" in levelDict else {
            "gravity": 100
        }  #check if physics are set

        self.player = objs.Player(levelDict["player"], levelDict["assetsDir"])

        self.objects = []
        for x in levelDict["objects"]:
            self.objects.append(
                objs.Sprite(x, assetdir=self.assetsDir, ss=self.spriteSheet))

        self.background = []
        if "backgrounds" in levelDict:
            for x in levelDict["backgrounds"]:
                self.background.append(objs.Background(x, self.assetsDir))

            self.background = sorted(self.background,
                                     key=lambda x: x.distance,
                                     reverse=True)

        map = levelDict["map"]
        map = map[::-1]
        for y in range(len(map)):
            for x in range(len(map[y])):
                if map[y][x] != 0:
                    self.objects[map[y][x] - 1].instances.append([x, y])
Пример #7
0
 def __init__(self):
     load_image = rgl.util.load_image
     self.oldman1 = spritesheet("data/lawn-mower.png", (96, 96))
     self.bubbman1 = spritesheet("data/bubbman.png", (24, 26))[1:][:2]
     self.oldman2 = spritesheet("data/oldman.png", (24, 26))
     self.bubbman2 = spritesheet("data/lawn-mower2.png", (96, 96))
     self.ground = spritesheet("data/grass-2.png", (24, 24))[1]
     self.fg = load_image("data/hills-front-1.png")
     self.fg2 = load_image("data/hills-back.png")
     self.bg = load_image("data/background-2.png")
     self.font_white = rgl.font.Font(NES_FONT, (255, 255, 255))
     self.font_black = rgl.font.Font(NES_FONT, (1, 1, 1))
     self.frame = 0
     self.pos = 0
     self.bubbmanpos = -128
     self.oldmanpos = -256
     self.ochasing = True
     self.transitioning = True
     self.shake = 0
     self.credits = [
         "Created by",
         "pymike",
         "",
         "",
         "",
         "Music by",
         "Operation D",
         "",
         "",
         "",
         "Sounds mixed with",
         "SFXR by DrPetter",
         "",
         "",
         "",
         "Graphics created with",
         "The Gimp 2",
         "",
         "",
         "",
         "Programmed in",
         "the python language"
         "",
         "",
         "",
         "Graphics library",
         "pygame and retrogamelib",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "",
         "Thanks for playing!!"
         ]