Exemple #1
0
    def __init__(self, tw, mapw, maph, startXTile, startYTile, numXTiles, numYTiles):
        """ NEED TO MOVE THIS SHIT INTO THE RIGHT CONFIG FILE """
        self.tw = tw
        self.mapw = mapw
        self.maph = maph
        self.startXTile = startXTile
        self.startYTile = startYTile
        self.numXTiles = numXTiles
        self.numYTiles = numYTiles
        self.tiledBG = pygame.Surface((numXTiles * self.tw, numYTiles * tw)).convert()

        config = ConfigParser.ConfigParser()
        config.readfp(open('gamemap.cfg'))
        self.zlevels = config.getint('map', 'zlevels')
        self.currentZlevel = 0
        if not pygame.font.get_init():
            pygame.font.init()
        self.arialFnt = pygame.font.SysFont('Arial', 12)
        imageset = "images" + str(tw)
        digset = "digimages" + str(tw)
        self.images = str(config.get('tiles', imageset)).split(', ')
        self.digimages = str(config.get('tiles', digset)).split(', ') #['digx32.png']
        self.mapdata = [[[ 0 for cols in xrange(self.maph)] for rows in xrange(self.mapw)] for z in xrange(self.zlevels)] #          [row for row in xrange(self.zlevels)]
        self.emapdata = [row for row in xrange(self.zlevels)]
        #["wall1x32.png", "grassx32.png", "grass2x32.png", "grass3x32.png", "grass4x32.png", "waterx32.png", "magmax32.png", 'uprampx32.png', 'downrampx32.png']
        self.tileimages = []
        for i in self.images:
            tempimg, temprect = loader.load_png(i)
            self.tileimages.append((tempimg, temprect))

        self.digtileimages = []
        for i in self.digimages:
            tempimg, temprect = loader.load_png(i)
            self.digtileimages.append((tempimg, temprect))
Exemple #2
0
 def __init__(self):
     self.image, self.rect = loader.load_png('proxyexplosion.png')
     screen = pygame.display.get_surface()
     self.frame = 0
     self.frame_step = 10
     self.frame_limit = 250
     self.area = screen.get_rect()
Exemple #3
0
 def __init__(self):
     self.image, self.rect = loader.load_png('player.png')
     screen = pygame.display.get_surface()
     self.isShooting = False
     self.area = screen.get_rect()
     self.speed = 10
     self.type = "normal" #bullet type
Exemple #4
0
 def __init__(self):
     self.image, self.rect = loader.load_png('proxy.png')
     screen = pygame.display.get_surface()
     self.isExploding = False
     self.area = screen.get_rect()
     self.speed = 10
     self.moveLeft = False
     self.moveRight = False
     self.moveUp = False
     self.moveDown = False
Exemple #5
0
 def __init__(self, tw, x, y):
     self.tw = tw
     self.position = [x, y]
     self.mapx = 0
     self.mapy = 0
     config = configparser.ConfigParser()
     config.read_file(open("cursor.cfg"))
     sectionname = "imagename" + str(tw)
     imagename = config.get("cursor", sectionname)
     self.image, self.rect = load_png(imagename)
Exemple #6
0
 def __init__(self, tw, x, y):
     self.tw = tw
     self.position = [x, y]
     self.mapx = 0
     self.mapy = 0
     config = ConfigParser.ConfigParser()
     config.readfp(open('cursor.cfg'))
     sectionname = "imagename" + str(tw)
     imagename = config.get('cursor', sectionname)
     self.image, self.rect = loader.load_png(imagename)
Exemple #7
0
 def __init__(self, tw, x, y):
     self.tw = tw
     self.position = [x, y]
     self.mapx = 0
     self.mapy = 0
     config = ConfigParser.ConfigParser()
     config.readfp(open('cursor.cfg'))
     sectionname = "imagename" + str(tw)
     imagename = config.get('cursor', sectionname)
     self.image, self.rect = loader.load_png(imagename)
Exemple #8
0
 def __init__(self, name, tw):
     self.tw = tw
     config = ConfigParser()
     config.readfp(open('item.cfg'))
     sectionname = 'imagename' + str(self.tw)
     self.movable = True # set this to false to make unmovable items.
     self.selected = False
     self.inqueue = False
     
     imagename = config.get(name, sectionname)
     self.image, self.rect = loader.load_png(imagename)
     self.name = name
     self.surface = pygame.transform.scale(self.image, (self.tw, self.tw))
Exemple #9
0
    def __init__(self, tw, mapw, maph, startXTile, startYTile, numXTiles, numYTiles):
        """ NEED TO MOVE THIS SHIT INTO THE RIGHT CONFIG FILE """
        self.tw = tw
        self.mapw = mapw
        self.maph = maph
        self.startXTile = startXTile
        self.startYTile = startYTile
        self.numXTiles = numXTiles
        self.numYTiles = numYTiles
        self.tiledBG = pygame.Surface((numXTiles * self.tw, numYTiles * tw)).convert()

        config = configparser.ConfigParser()
        config.read_file(open("gamemap.cfg"))
        self.zlevels = config.getint("map", "zlevels")
        self.currentZlevel = 0
        if not pygame.font.get_init():
            pygame.font.init()
        self.arialFnt = pygame.font.SysFont("Arial", 12)
        imageset = "images" + str(tw)
        digset = "digimages" + str(tw)
        self.images = str(config.get("tiles", imageset)).split(", ")
        self.digimages = str(config.get("tiles", digset)).split(", ")  # ['digx32.png']
        self.mapdata = [
            [[0 for cols in range(self.maph)] for rows in range(self.mapw)]
            for z in range(self.zlevels)
        ]  # [row for row in xrange(self.zlevels)]
        self.emapdata = [row for row in range(self.zlevels)]
        # ["wall1x32.png", "grassx32.png", "grass2x32.png", "grass3x32.png", "grass4x32.png", "waterx32.png", "magmax32.png", 'uprampx32.png', 'downrampx32.png']
        self.tileimages = []
        for i in self.images:
            tempimg, temprect = loader.load_png(i)
            self.tileimages.append((tempimg, temprect))

        self.digtileimages = []
        for i in self.digimages:
            tempimg, temprect = loader.load_png(i)
            self.digtileimages.append((tempimg, temprect))
Exemple #10
0
 def __init__(self, position, tw):
     self.tw = tw
     config = ConfigParser.ConfigParser()
     config.readfp(open('mob.cfg'))
     imageset = 'imagename' + str(self.tw)
     imagename = config.get('mob', imageset)
     self.image, self.rect = loader.load_png(imagename)
     self.position = position
     self.miningskill = 5
     self.name = "Jimmy"
     self.surface = pygame.transform.scale(self.image, (self.tw, self.tw))
     self.pathlines = []
     self.job = None
     self.skillcounter = 0
     self.carrying = None
Exemple #11
0
 def __init__(self, position, tw):
     self.tw = tw
     config = ConfigParser.ConfigParser()
     config.readfp(open('mob.cfg'))
     imageset = 'imagename' + str(self.tw)
     imagename = config.get('mob', imageset)
     self.image, self.rect = loader.load_png(imagename)
     self.position = position
     self.miningskill = 5
     self.name = "Jimmy"
     self.surface = pygame.transform.scale(self.image, (self.tw, self.tw))
     self.pathlines = []
     self.job = None
     self.skillcounter = 0
     self.carrying = None
Exemple #12
0
pygame.mouse.set_visible(False)
mainClock = pygame.time.Clock()
# set up font
pygame.font.init()
font = pygame.font.Font('data/freesansbold.ttf', 32)

# set up sounds
gameOverSound = loader.load_sound('gameover.wav')
#TODO build some sort of music handling queue / control object.
pygame.mixer.music.load('./data/theme.ogg')
#pygame.mixer.music.load('data/background.mid')

# set up images
player = player.Player()
proxy = proxy.Proxy()
baddieImage, baddieRect = loader.load_png('baddie.png')
bulletImage, bulletRect = loader.load_png('bullet.png')
powerupImage, powerupRect = loader.load_png('powerup.png')

# show the "Start" screen
drawText('JShooter', font, windowSurface, (WINDOWWIDTH / 10), (WINDOWHEIGHT / 10))
drawText('Mouse Move', font, windowSurface, (WINDOWWIDTH / 10), (WINDOWHEIGHT / 10)+50)
drawText('Mouse Button1 Shoots', font, windowSurface, (WINDOWWIDTH / 10), (WINDOWHEIGHT / 10)+100)
drawText('WASD Moves Proxy', font, windowSurface, (WINDOWWIDTH / 10), (WINDOWHEIGHT / 10)+150)
drawText('Spacebar Proxy BOMB', font, windowSurface, (WINDOWWIDTH / 10), (WINDOWHEIGHT / 10)+200)
drawText('TAB Teleport', font, windowSurface, (WINDOWWIDTH / 10), (WINDOWHEIGHT / 10)+250)
drawText('[ & ] Adjust Music Volume', font, windowSurface, (WINDOWWIDTH / 10), (WINDOWHEIGHT / 10)+300)
drawText('m mutes the Music', font, windowSurface, (WINDOWWIDTH / 10), (WINDOWHEIGHT / 10)+350)
drawText('Pause: p, Q or ESC Quits', font, windowSurface, (WINDOWWIDTH / 10), (WINDOWHEIGHT / 10)+400)
drawText('Press a key to start.', font, windowSurface, (WINDOWWIDTH / 3) - 30, (WINDOWHEIGHT / 3) + 450)
pygame.display.update()