img = pygame.image.load('data/images/' + path + '.png').convert()
    img.set_colorkey((255, 0, 255))
    return img


tile_img = load_img('tile')
spikes_img = load_img('spikes')
apple_img = load_img('apple')
ghost_img = load_img('ghost')
timer_img = load_img('timer')
end_img = load_img('end')

controls_1_img = load_img('controls_1')
controls_2_img = load_img('controls_2')

e.set_global_colorkey((255, 0, 255))
e.load_animations('data/images/entities/')
e.load_particle_images('data/images/particles/')

# SFX -------------------------------------------------------- #
jump_s = pygame.mixer.Sound('data/sfx/jump.wav')
apple_s = pygame.mixer.Sound('data/sfx/apple.wav')
death_s = pygame.mixer.Sound('data/sfx/death.wav')
end_s = pygame.mixer.Sound('data/sfx/end.wav')
ghost_s = pygame.mixer.Sound('data/sfx/ghost.wav')
ghost_s.set_volume(0.2)
jump_s.set_volume(0.4)
apple_s.set_volume(0.6)
end_s.set_volume(0.8)
death_s.set_volume(0.7)
Beispiel #2
0
clock = pygame.time.Clock()

from pygame.locals import *
pygame.mixer.pre_init(44100, -16, 2, 512)
pygame.init() # initiates pygame
pygame.mixer.set_num_channels(64)

pygame.display.set_caption('Pygame Platformer')

WINDOW_SIZE = (1280,720)

screen = pygame.display.set_mode(WINDOW_SIZE,0,32) # initiate the window

display = pygame.Surface((640,360)) # used as the surface for rendering, which is scaled

e.set_global_colorkey((203,217,217))

player_width = 32
player_height = 64

moving_right = False
moving_left = False
vertical_momentum = 0
air_timer = 0

true_scroll = [0,0]

SPRITE_SIZE = 32
CHUNK_SIZE = 8

def generate_chunk(x,y):
Beispiel #3
0
# Setup pygame/window ---------------------------------------- #
mainClock = pygame.time.Clock()
from pygame.locals import *

pygame.init()
pygame.display.set_caption('Aeroblaster')
screen = pygame.display.set_mode((894, 594), 0, 32)
pygame.mouse.set_visible(False)
pygame.event.set_grab(True)
display = pygame.Surface((300, 200))
main_display = display.copy()
main_display.set_colorkey((0, 0, 0))
# Images ----------------------------------------------------- #
tileset_images = load_tileset('data/images/')
e.set_global_colorkey((0, 0, 0))
e.load_animations('data/images/entities/')
e.load_particle_images('data/images/particles/')
gun_img = load_img('gun')
cursor_img = load_img('cursor')
turret_barrel_img = load_img('turret_barrel')
turret_shot_img = load_img('turret_shot')
core_img = load_img('core')
turret_example_img = load_img('turret_example')
shot_example_img = load_img('shot_example')
controls_1 = load_img('controls_1')
controls_2 = load_img('controls_2')
pause_menu = load_img('pause_menu')

# Sound ------------------------------------------------------ #
jump_s = pygame.mixer.Sound('data/sfx/jump.wav')