This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ControlPointCollectionFactory(): | |
@staticmethod | |
def create_collection1(): | |
control_point_quartet_collection = ControlPointQuartetCollection() | |
control_point_quartet_collection.add(ControlPointQuartet( | |
513, -15, | |
700, 151, | |
888, 650, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result = pygame.sprite.groupcollide(self.all_rockets, self.all_enemies, True, True) | |
if result: | |
for key in result: | |
self.score += 120 | |
if self.score > self.high_score: | |
self.high_score = self.score | |
self.all_sprites.add(Explosion(self.explosion_sprites, key.rect[0], key.rect[1])) | |
self.kill_sound.play() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def shoot_rocket(self): | |
rocket = Rocket(self.sprites, 0, -15) | |
rocket.rect.centerx = self.player.rect.centerx | |
self.all_rockets.add(rocket) | |
self.all_sprites.add(rocket) | |
self.shoot_sound.play() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player(pygame.sprite.Sprite): | |
def __init__(self, sprites): | |
super(Player, self).__init__() | |
self.timer = 0 | |
self.interval = 2 | |
self.number_of_images = 6 | |
self.images = sprites.load_strip([0, 130, 48, 45], self.number_of_images, -1) | |
self.surf = self.images[0] | |
self.rect = self.surf.get_rect(center=(constants.SCREEN_WIDTH / 2, constants.SCREEN_HEIGHT - 40)) | |
self.image_index = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Splash(BaseState): | |
def __init__(self): | |
super(Splash, self).__init__() | |
self.title = self.font.render("PyGalaga", True, pygame.Color("blue")) | |
self.title_rect = self.title.get_rect(center=self.screen_rect.center) | |
self.next_state = "MENU" | |
self.time_active = 0 | |
def update(self, dt): | |
self.time_active += dt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(self): | |
while not self.done: | |
dt = self.clock.tick(self.fps) | |
self.event_loop() | |
self.update(dt) | |
self.draw() | |
pygame.display.update() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseState(object): | |
def __init__(self): | |
self.done = False | |
self.quit = False | |
self.next_state = None | |
self.screen_rect = pygame.display.get_surface().get_rect() | |
self.font = pygame.font.Font(None, 32) | |
def startup(self): | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseState(object): | |
def __init__(self): | |
self.done = False | |
self.quit = False | |
self.next_state = None | |
self.screen_rect = pygame.display.get_surface().get_rect() | |
self.font = pygame.font.Font(None, 32) | |
def startup(self): | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cert = fetch("YOUR FAIRPLAY CERTIFICATE URL"); | |
if (this.platform.SAFARI) { | |
this.player.configure({ | |
preferredAudioLanguage: 'en-US', | |
drm: { | |
servers: { | |
'com.apple.fps.1_0': '[fairplay license server URL]', | |
}, | |
advanced: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let captionUrl = "http://amssamples.streaming.mediaservices.windows.net/bc57e088-27ec-44e0-ac20-a85ccbcd50da/TOS-en.vtt"; | |
this.player | |
.load(videoUrl) | |
.then(() => { | |
this.player.addTextTrackAsync(captionUrl, "en", "subtitle", 'text/vtt').then(() => {{ | |
const textTracks = this.player.getTextTracks(); | |
if (textTracks.length > 0) { | |
this.player.setTextTrackVisibility(true); | |
this.player.selectTextTrack(textTracks[0]); | |
} |