def load_game_resources(): #load ship graphics global images i = gfx.load('baddie.png') i = pygame.transform.flip(i, 0, 1) i.set_colorkey((0,0,0)) imgs = gfx.animstrip(i, 64) del imgs[9] #clean animation a little images.append(imgs) for x in (90, 180, 270): rotimgs = [] for i in imgs: r = pygame.transform.rotate(i, x) rotimgs.append(r) images.append(rotimgs) i = gfx.load('baddie-teleport.png') i = pygame.transform.flip(i, 0, 1) i.set_colorkey((0,0,0)) imgs = gfx.animstrip(i, 64) teleimages.append(imgs) for x in (90, 180, 270): rotimgs = [] for i in imgs: r = pygame.transform.rotate(i, x) rotimgs.append(r) teleimages.append(rotimgs)
def load_game_resources(): #load ship graphics global images i = gfx.load('baddie.png') i = pygame.transform.flip(i, 0, 1) i.set_colorkey((0, 0, 0)) imgs = gfx.animstrip(i, 64) del imgs[9] #clean animation a little images.append(imgs) for x in (90, 180, 270): rotimgs = [] for i in imgs: r = pygame.transform.rotate(i, x) rotimgs.append(r) images.append(rotimgs) i = gfx.load('baddie-teleport.png') i = pygame.transform.flip(i, 0, 1) i.set_colorkey((0, 0, 0)) imgs = gfx.animstrip(i, 64) teleimages.append(imgs) for x in (90, 180, 270): rotimgs = [] for i in imgs: r = pygame.transform.rotate(i, x) rotimgs.append(r) teleimages.append(rotimgs)
def load_game_resources(): global menu, images, boximages, fame images = [] pos = [20, 380] #[100, 420] odd = 0 for m in menu: m.init(pos) pos[0] += 150 odd = (odd+1)%2 if odd: pos[1] += 20 else: pos[1] -= 20 images.append(gfx.load('menu_on_bgd.png')) images[0].set_colorkey(0) images.append(gfx.load('logo.png')) images.append(gfx.load('ship-big.png')) images[1].set_colorkey() images[2].set_colorkey() global boximages, yboximages, rboximages imgs = gfx.load_raw('bigboxes.png') origpal = imgs.get_palette() boximages = gfx.animstrip(imgs) pal = [(g,g,b) for (r,g,b) in origpal] imgs.set_palette(pal) yboximages = gfx.animstrip(imgs) pal = [(g,b,b) for (r,g,b) in origpal] imgs.set_palette(pal) rboximages = gfx.animstrip(imgs) fame = gfx.load('fame.png') snd.preload('select_move', 'select_choose')
def load_game_resources(): global images images = gfx.animstrip(gfx.load('smoke.png')) if gfx.surface.get_bytesize()>1: #16 or 32bit i = 1 for img in images: img.set_alpha((1.8-math.log(i))*40, pygame.RLEACCEL) i += 1
def load_game_resources(): global images images = gfx.animstrip(gfx.load('smoke.png')) if gfx.surface.get_bytesize() > 1: #16 or 32bit i = 1 for img in images: img.set_alpha((1.8 - math.log(i)) * 40, pygame.RLEACCEL) i += 1
def load_game_resources(): global boximages, yboximages, rboximages, wboximages global popimages, spikeimages, wspikeimages imgs = gfx.load_raw('boxes.png') origpal = imgs.get_palette() boximages = gfx.animstrip(imgs) pal = [(g, g, b) for (r, g, b) in origpal] imgs.set_palette(pal) yboximages = gfx.animstrip(imgs) pal = [(g, b, b) for (r, g, b) in origpal] imgs.set_palette(pal) rboximages = gfx.animstrip(imgs) pal = [min(g + 60, 255) for (r, g, b) in origpal] imgs.set_palette(zip(pal, pal, pal)) wboximages = gfx.animstrip(imgs) popimages = gfx.animstrip(gfx.load('popbox.png')) spikes = gfx.load_raw('spikeball.png') origpal = spikes.get_palette() spikeimages = gfx.animstrip(spikes) pal = [(min(r + 100, 255), min(g + 100, 255), min(b + 100, 255)) for r, g, b in origpal] spikes.set_palette(pal) wspikeimages = gfx.animstrip(spikes) snd.preload('boxhit', 'yboxhit')
def load_game_resources(): global images, debris img = gfx.load('explosion.png') images.extend(gfx.animstrip(img)) debrisnames = 'base', 'bubble', 'motor' debristemp = [] for d in debrisnames: strip = gfx.load('debris-' + d + '.png') #strip.insert(0, strip[0]) debristemp.append(gfx.animstrip(strip)) #need to to rotations? for i in (0,1,1,2,2): debris.append(debristemp[i]) for d in range(1,5): strip = gfx.load('debris%d.png'%d) debris.append(gfx.animstrip(strip))
def load_game_resources(): global images, debris img = gfx.load('explosion.png') images.extend(gfx.animstrip(img)) debrisnames = 'base', 'bubble', 'motor' debristemp = [] for d in debrisnames: strip = gfx.load('debris-' + d + '.png') #strip.insert(0, strip[0]) debristemp.append(gfx.animstrip(strip)) #need to to rotations? for i in (0, 1, 1, 2, 2): debris.append(debristemp[i]) for d in range(1, 5): strip = gfx.load('debris%d.png' % d) debris.append(gfx.animstrip(strip))
def load_game_resources(): #load shot graphics global images, allimages, darkimages img = gfx.load_raw('fire.png') origpal = img.get_palette() img.set_colorkey(img.get_at((0,0))) images = gfx.animstrip(img) allimages.append(images) for x in range(10, 181, 10): pal = [(max(r-x*.28,0), max(g-x*.48,0), min(b+x*.38,255)) for (r,g,b) in origpal] img.set_palette(pal) allimages.append(gfx.animstrip(img)) for i in gfx.animstrip(img): i.set_alpha(128, pygame.RLEACCEL) darkimages.append(i)
def load_game_resources(): global corsair_image global player_images, greenstalker_images, bluestalker_images, graystalker_images global yellowstalker_images, lightgreenstalker_images, war_airplaneimages global gunner_images, nogunfighter_images, inv_bluestalker_images, inv_greenstalker_images global inv_yellowstalker_images, striker_image, fighter_image #load airplanes graphics for img in gfx.animstrip(gfx.load('player.png'), width=59, ckey=(0, 0, 0)): player_images.append(img) for img in gfx.animstrip(gfx.load('war_airplanes.png'), width=93, ckey=(0, 67, 171)): war_airplaneimages.append(img) for img in gfx.animstrip(gfx.load('greenstalker.png'), width=31, ckey=(0, 67, 171)): i = pygame.transform.rotate(img, 90) j = pygame.transform.rotate(img, -90) greenstalker_images.append(i) inv_greenstalker_images.append(j) for img in gfx.animstrip(gfx.load('bluestalker.png'), width=31, ckey=(0, 67, 171)): i = pygame.transform.rotate(img, 90) j = pygame.transform.rotate(img, -90) bluestalker_images.append(i) inv_bluestalker_images.append(j) for img in gfx.animstrip(gfx.load('graystalker.png'), width=31, ckey=(0, 67, 171)): img = pygame.transform.rotate(img, 90) graystalker_images.append(img) for img in gfx.animstrip(gfx.load('yellowstalker.png'), width=31, ckey=(0, 67, 171)): i = pygame.transform.rotate(img, 90) j = pygame.transform.rotate(img, -90) yellowstalker_images.append(i) inv_yellowstalker_images.append(j) for img in gfx.animstrip(gfx.load('lightgreenstalker.png'), width=31, ckey=(0, 67, 171)): img = pygame.transform.rotate(img, 90) lightgreenstalker_images.append(img) for img in gfx.animstrip(gfx.load('gunner.png'), width=60, ckey=(0, 67, 171)): gunner_images.append(img) for img in gfx.animstrip(gfx.load('nogunfighter.png'), width=33, ckey=(0, 67, 171)): nogunfighter_images.append(img) striker_image = gfx.load('striker.png') corsair_image = gfx.load('corsair.png') fighter_image = gfx.load('fighter.png')
def load_game_resources(): global rbigboximages, gbigboximages, bbigboximages, wbigboximages global rboximages, gboximages, bboximages, wboximages global popimages, spikeimages, wspikeimages ### Big Boxes ### imgs = gfx.load_raw('bigboxes.png') imgs.set_colorkey(imgs.get_at((0, 0))) origpal = imgs.get_palette() gbigboximages = gfx.animstrip(imgs) rbigboximages = red_animation(origpal, imgs) bbigboximages = blue_animation(origpal, imgs) ### Small Boxes ### imgs = gfx.load_raw('boxes.png') origpal = imgs.get_palette() gboximages = gfx.animstrip(imgs) rboximages = red_animation(origpal, imgs) bboximages = blue_animation(origpal, imgs) wboximages = white_animation(origpal, imgs) ### Popping box ### popimages = gfx.animstrip(gfx.load('popbox.png')) ### Spike ### spikes = gfx.load_raw('spikeball.png') origpal = spikes.get_palette() spikeimages = gfx.animstrip(spikes) pal = [(min(r + 100, 255), min(g + 100, 255), min(b + 100, 255)) for r, g, b in origpal] spikes.set_palette(pal) wspikeimages = gfx.animstrip(spikes) ### Sounds ### snd.preload('boxhit', 'yboxhit')
def load_game_resources(): global images, origsize anim = gfx.animstrip(gfx.load('asteroid.png')) origsize = anim[0].get_size() for x in range(36): set = [] for img in anim: r = pygame.transform.rotate(img, x * 10 + 8) set.append(r.convert()) images.append(set)
def load_game_resources(): global images, origsize anim = gfx.animstrip(gfx.load('asteroid.png')) origsize = anim[0].get_size() for x in range(36): set = [] for img in anim: r = pygame.transform.rotate(img, x*10+8) set.append(r.convert()) images.append(set)
def load_game_resources(): global rbigboximages, gbigboximages, bbigboximages, wbigboximages global rboximages, gboximages, bboximages, wboximages global popimages, spikeimages, wspikeimages ### Big Boxes ### imgs = gfx.load_raw('bigboxes.png') imgs.set_colorkey(imgs.get_at((0, 0))) origpal = imgs.get_palette() gbigboximages = gfx.animstrip(imgs) rbigboximages = red_animation(origpal, imgs) bbigboximages = blue_animation(origpal, imgs) ### Small Boxes ### imgs = gfx.load_raw('boxes.png') origpal = imgs.get_palette() gboximages = gfx.animstrip(imgs) rboximages = red_animation(origpal, imgs) bboximages = blue_animation(origpal, imgs) wboximages = white_animation(origpal, imgs) ### Popping box ### popimages = gfx.animstrip(gfx.load('popbox.png')) ### Spike ### spikes = gfx.load_raw('spikeball.png') origpal = spikes.get_palette() spikeimages = gfx.animstrip(spikes) pal = [(min(r+100,255),min(g+100,255),min(b+100,255)) for r,g,b in origpal] spikes.set_palette(pal) wspikeimages = gfx.animstrip(spikes) ### Sounds ### snd.preload('boxhit', 'yboxhit')
def load_game_resources(): global images #for i in range(1,16): # img = gfx.load('warp_%04d.gif'%i) # images.append(img) images = gfx.animstrip(gfx.load('ship-warp.png'), 48) #~ # Hold the blank frame for a few extra counts. #~ images[12:] = [images[11]]*2 + [images[-1], images[-2], images[-2], images[-1]] #~ # Add on an extra bit of twinkle at the end. #~ #images.extend([images[-2],images[-2]]) images.extend([images[-1]] * 2)
def load_game_resources(): global images #for i in range(1,16): # img = gfx.load('warp_%04d.gif'%i) # images.append(img) images = gfx.animstrip(gfx.load('ship-warp.png'), 48) #~ # Hold the blank frame for a few extra counts. #~ images[12:] = [images[11]]*2 + [images[-1], images[-2], images[-2], images[-1]] #~ # Add on an extra bit of twinkle at the end. #~ #images.extend([images[-2],images[-2]]) images.extend([images[-1]]*2)
def load_game_resources(): #load ship graphics global upimage, shipimages, shieldbg, bulletbg upimage = gfx.load('ship-up.png') anim = [] for img in gfx.animstrip(gfx.load('ship-up-boost1.png')): imgs = [img] for i in range(90, 359, 90): imgs.append(pygame.transform.rotate(img, i)) anim.append(imgs) shipimages.extend(list(zip(*anim))) anim = [] for img in gfx.animstrip(gfx.load('ship-up-boost2.png')): imgs = [img] for i in range(90, 359, 90): imgs.append(pygame.transform.rotate(img, i)) anim.append(imgs) shipimages.extend(list(zip(*anim))) shieldbg = gfx.animstrip(gfx.load('bonus-shield.png')) bulletbg = gfx.animstrip(gfx.load('bonus-bullet.png'))
def load_game_resources(): #load ship graphics global upimage, shipimages, shieldbg, bulletbg upimage = gfx.load('ship-up.png') anim = [] for img in gfx.animstrip(gfx.load('ship-up-boost1.png')): imgs = [img] for i in range(90, 359, 90): imgs.append(pygame.transform.rotate(img, i)) anim.append(imgs) shipimages.extend(zip(*anim)) anim = [] for img in gfx.animstrip(gfx.load('ship-up-boost2.png')): imgs = [img] for i in range(90, 359, 90): imgs.append(pygame.transform.rotate(img, i)) anim.append(imgs) shipimages.extend(zip(*anim)) shieldbg = gfx.animstrip(gfx.load('bonus-shield.png')) bulletbg = gfx.animstrip(gfx.load('bonus-bullet.png'))
def load_game_resources(): global images, fonts, downimgs, ship img = gfx.load('menu_news_on.png') r = img.get_rect().move(10, 10) images.append((img, r)) img = gfx.load('download.png') downimgs = gfx.animstrip(img, img.get_width() / 2) for i in ('downerror', 'newversion', 'downok'): img = gfx.load(i + '.gif') downimgs.append(img) fonts.append((txt.Font(None, 36, italic=1), (150, 150, 200))) fonts.append((txt.Font(None, 22), (120, 120, 250))) fonts.append((txt.Font(None, 28), (120, 120, 250))) ship = pygame.transform.rotate(gfx.load('ship-up.png'), -90) snd.preload('select_choose', 'startlife', 'levelskip')
def load_game_resources(): global images, fonts, downimgs, ship img = gfx.load('menu_news_on.png') r = img.get_rect().move(10, 10) images.append((img, r)) img = gfx.load('download.png') downimgs = gfx.animstrip(img, img.get_width()/2) for i in ('downerror', 'newversion', 'downok'): img = gfx.load(i+'.gif') downimgs.append(img) fonts.append((txt.Font(None, 36, italic=1), (150, 150, 200))) fonts.append((txt.Font(None, 22), (120, 120, 250))) fonts.append((txt.Font(None, 28), (120, 120, 250))) ship = pygame.transform.rotate(gfx.load('ship-up.png'), -90) snd.preload('select_choose', 'startlife', 'levelskip')
def load_game_resources(): global images, imagesbaddie img = gfx.load('ship-teleport.png') images.extend(gfx.animstrip(img))
def load_game_resources(): global small_explode_images, big_explode_images small_explode_images = gfx.animstrip(gfx.load('explosion_small.png'), width=33) big_explode_images = gfx.animstrip(gfx.load('explosion_big.png'), width=66)
def load_game_resources(): global images images = gfx.animstrip(gfx.load('popshot.png'), 18)
def red_animation(palette, images): images.set_palette([(g,b,b) for (r,g,b) in palette]) return gfx.animstrip(images)
def red_animation(palette, images): images.set_palette([(g, b, b) for (r, g, b) in palette]) return gfx.animstrip(images)
def load_game_resources(): global images, symbols images = gfx.animstrip(gfx.load('powerup.png')) symbols = gfx.animstrip(gfx.load('powereffects.png')) snd.preload('select_choose')
def white_animation(palette, images): intensities = [min(g+60,255) for (r,g,b) in palette] images.set_palette([(i,i,i) for i in intensities]) return gfx.animstrip(images)
def white_animation(palette, images): intensities = [min(g + 60, 255) for (r, g, b) in palette] images.set_palette([(i, i, i) for i in intensities]) return gfx.animstrip(images)
def blue_animation(palette, images): images.set_palette([(b, b, g) for (r, g, b) in palette]) return gfx.animstrip(images)
def blue_animation(palette, images): images.set_palette([(b,b,g) for (r,g,b) in palette]) return gfx.animstrip(images)