def __init__(self): """Initialisation of the engine first is used for finding the most likely positioning of the rope on the first run through. A different more exhaustive and slower approach is taken for this search """ self.rope = rope.Rope() self.first = True self.lace = None
def new_gunner(self): if not self.helicopter.alive: return if len(self.gunners) > 1: self.message("YOU'RE UP %s" % self.gunners[-1], 2.0) else: self.message("%s, YOU'RE OUR LAST HOPE" % self.gunners[-1], 2.0) self.gunner = gunner.Gunner(self.helicopter.vposition.x, self.helicopter.vposition.y, batch=self.sprite_batch, context=self) self.rope = rope.Rope(length=ROPE_SEGMENTS, anchor_start=self.helicopter, anchor_end=self.gunner, x=self.helicopter.vposition.x, y=self.helicopter.vposition.y) resources.gunner_jump.play()
def load_stage(self, stage, demo=False): #, checkpoint=None): """Load a stage procedurally, or from a file. This method will import the named module, and load the class within. The class must be named Stage<Name> where <Name> is the capitalized version of the module name.""" self.demo = demo classname = "Stage%s" % stage.title() module = __import__(stage) class_obj = getattr(module, classname) if not demo: self.helicopter = helicopter.Helicopter(400, 400, batch=self.sprite_batch, context=self) self.gunner = gunner.Gunner(400, 400, batch=self.sprite_batch, context=self) self.rope = rope.Rope(length=ROPE_SEGMENTS, anchor_start=self.helicopter, anchor_end=self.gunner) self.message("GET READY SOLDIER") self.stage = class_obj(context=self) # Zero out all of the bullets self.bullets = [] self.bullet_pool = [] # Fill the bullet pool with dead bullet objects for i in range(BULLET_POOL): b = bullet.Bullet(x=0, y=0, batch=self.sprite_bullet_batch) self.bullet_pool.append(b) self.bullets.append(b) if self.stage.music == None: self.music_player = None else: self.music_player = pyglet.media.Player() self.music_player.queue(self.stage.music) self.music_player.eos_action = 'loop' self.music_player.play()
def __init__(self): """Engine class for image processing - Kmeans version """ self.rope = rope.Rope() self.lace = None
def __init__(self): """Engine for mask_mapping """ self.rope = rope.Rope() self.first = True self.lace = None