def create_enemy(self):
     enemy_start = self.scenario.enemy_start
     # apply a little random variance +/-10 in the x and y
     # so that all enemies don't start in exactly the same place
     x = enemy_start[0] + random.uniform(-10, 10)
     y = enemy_start[1] + random.uniform(-10, 10)
     self.add(actors.Enemy(x, y, self.scenario.enemy_actions))
示例#2
0
    def create_enemy(self):
        """Apply a random offset of (-10,10) so the enemy doesn't always spawn from the same place"""
        enemy_start_position = self.scenario.enemy_start_position
        x = enemy_start_position[0] + random.uniform(-10, 10)
        y = enemy_start_position[1] + random.uniform(-10, 10)

        self.add(actors.Enemy(x, y, self.scenario.actions))
示例#3
0
    def __init__(self):
        self.atlas = globals.atlas = drawing.texture.TextureAtlas(
            'tiles_atlas_0.png', 'tiles_atlas.txt')
        self.sentry_lights = []
        self.enemies = []
        globals.ui_atlas = drawing.texture.TextureAtlas('ui_atlas_0.png',
                                                        'ui_atlas.txt',
                                                        extra_names=False)
        self.enemy_positions = []
        self.map = GameMap('level1.txt', self)
        self.map.world_size = self.map.size * globals.tile_dimensions
        self.viewpos = Viewpos(Point(100, 400))
        self.player_direction = Point(0, 0)
        self.game_over = False
        self.mouse_world = Point(0, 0)
        self.mouse_pos = Point(0, 0)
        #pygame.mixer.music.load('music.ogg')
        #self.music_playing = False
        super(GameView, self).__init__(Point(0, 0), globals.screen)
        #skip titles for development of the main game
        self.mode = modes.Titles(self)
        self.light = drawing.Quad(globals.light_quads)
        self.light.SetVertices(Point(0, 0), globals.screen_abs - Point(0, 0),
                               0)
        self.nightlight = drawing.Quad(globals.nightlight_quads)
        self.nightlight.SetVertices(Point(0, 0),
                                    globals.screen_abs - Point(0, 0), 0.01)
        self.timeofday = TimeOfDay(0.1)
        #self.mode = modes.LevelOne(self)
        self.StartMusic()
        self.fixed_light = actors.FixedLight(Point(11, 38), Point(26, 9))
        self.interact_box = ui.Box(parent=globals.screen_root,
                                   pos=Point(0.3, 0.0),
                                   tr=Point(0.5, 0.08),
                                   colour=(0.5, 0.5, 0.5, 0.7))
        self.interact_box.title = ui.TextBox(
            self.interact_box,
            bl=Point(0, 0),
            tr=Point(1, 1),
            text='Opening...',
            textType=drawing.texture.TextTypes.SCREEN_RELATIVE,
            colour=(0, 0, 0, 1),
            scale=9,
            alignment=drawing.texture.TextAlignments.CENTRE)
        self.interact_box.progress = ui.PowerBar(
            self.interact_box,
            pos=Point(0.1, 0.3),
            tr=Point(0.9, 0.6),
            level=0.6,
            bar_colours=(drawing.constants.colours.red,
                         drawing.constants.colours.yellow,
                         drawing.constants.colours.green),
            border_colour=drawing.constants.colours.white)
        self.interact_box.Disable()

        for pos in self.enemy_positions:
            self.enemies.append(actors.Enemy(self.map, pos))
示例#4
0
 def getEnemies(self):
     members = []
     newMember = actors.Enemy()
     newMember.setName("Dust Bunny A")
     members.append(newMember)
     newMember = actors.Enemy()
     newMember.setName("Dust Bunny B")
     members.append(newMember)
     newMember = actors.Enemy()
     newMember.setName("Dust Bunny C")
     members.append(newMember)
     newMember = actors.Enemy()
     newMember.setName("Dust Bunny D")
     members.append(newMember)
     newMember = actors.Enemy()
     newMember.setName("Dust Bunny E")
     members.append(newMember)
     newMember = actors.Enemy()
     newMember.setName("Dust Bunny F")
     members.append(newMember)
     return members
示例#5
0
 def create_enemy(self):
     enemy_start = self.scenario.enemy_start
     x = enemy_start[0] + random.uniform(-10, 10)
     y = enemy_start[1] + random.uniform(-10, 10)
     self.add(actors.Enemy(x, y, self.scenario.actions))
示例#6
0
 def create_enemy(self):
     enemy_start = self.scenario.enemy_start #敵人出生位置
     x = enemy_start[0] + random.uniform(-10, 10) #用於避免一直重生在相同座標,所以加入+/-10象素隨機位移
     y = enemy_start[1] + random.uniform(-10, 10)
     self.add(actors.Enemy(x, y, self.scenario.actions)) #敵人出生