Beispiel #1
0
 def __init__(self, bname, battract, bintellij, bbudget, btypes,
              battractReq):
     Boy.__init__(self, bname, battract, bintellij, bbudget, btypes,
                  battractReq)
     self.bstatus = False
     self.bhappiness = 0
     self.gf = ''
Beispiel #2
0
def enter():

    global back
    back = Back()
    game_world.add_object(back, 0)

    global stage_one_back
    stage_one_back = Stage_one_Back()
    game_world.add_object(stage_one_back, 0)

    # global ladders
    # ladders = [Ladder(ladder_position[i]) for i in range(2)]
    # for ladder in ladders:
    #     ladder.set_background(stage_one_back)
    # game_world.add_objects(ladders, 1)

    global boy
    boy = Boy()
    game_world.add_object(boy, 2)

    global mooks
    mooks = [Mook(mook_position[i]) for i in range(6)]

    for mook in mooks:
        mook.set_background(stage_one_back)
    game_world.add_objects(mooks, 4)

    stage_one_back.set_center_object(boy)
    boy.set_background(stage_one_back)

    global ui
    ui= Ui()
    game_world.add_object(ui, 6)
Beispiel #3
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global balls
    balls = [Ball() for i in range(10)]
    game_world.add_objects(balls, 1)

    background.set_center_object(boy)
    boy.set_background(background)
    balls[0].set_background(background)
    balls[1].set_background(background)
    balls[2].set_background(background)
    balls[3].set_background(background)
    balls[4].set_background(background)
    balls[5].set_background(background)
    balls[6].set_background(background)
    balls[7].set_background(background)
    balls[8].set_background(background)
    balls[9].set_background(background)
Beispiel #4
0
def enter():
    global boy, ghost
    boy = Boy()
    ghost = Boy()
    grass = Grass()
    game_world.add_object(grass, 0)
    game_world.add_object(boy, 1)
Beispiel #5
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)  # 백그라운드에 boy를 알려줌
    boy.set_background(background)  # boy에 백그라운드를 알려줌
Beispiel #6
0
def get_boy_list():
    """
    Autogenerates a random boy list
    :return:
    """
    boy_data = []
    for i in range(1, 30):
        boy_data.append(Boy(str(i)+'miser', random.randint(1, 1000), random.randint(1, 1000), random.randint(1, 1000), random.randint(1, 10000), 'miser'))
        boy_data.append(Boy(str(i)+'generous', random.randint(1, 1000), random.randint(1, 1000), random.randint(1, 1000), random.randint(1, 10000), 'generous'))
        boy_data.append(Boy(str(i)+'geek', random.randint(1, 1000), random.randint(1, 1000), random.randint(1, 1000), random.randint(1, 10000), 'geek'))
    return boy_data
def enter():
    global boy

    boy = Boy()
    bg = Background()

    boy.bg = bg
    bg.target = boy

    game_world.add_object(bg, game_world.layer_bg)
    game_world.add_object(boy, game_world.layer_player)
Beispiel #8
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)
    boy.set_background(background)
Beispiel #9
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global back
    back = FixedBackground()
    back.set_center_object(boy)
    boy.set_background(back)
    game_world.add_object(back, 0)

    global balls
    balls = [Ball(back) for i in range(100)]
    game_world.add_objects(balls, 1)
Beispiel #10
0
def enter():
    global back_music
    image = load_image('ui\\title.png')
    back_music = load_music('Music\\ingame_Bgm.mp3')
    back_music.set_volume(64)
    back_music.repeat_play()
    get_time()
    global boy, boy1, grass, Inventory, bullet, score
    bullet = Bullet()
    boy = Boy()
    boy1 = Boy()

    score = game_Score()

    Inventory = inventory()
    grass = Grass()
    boy.Get_maptile(grass.line)
    boy1.Get_maptile(grass.line)
    boy.Get_inven(Inventory)
    boy1.Get_inven(Inventory)
    game_world.add_object(grass, 0)
    game_world.add_object(score, 0)
    game_world.add_object(Inventory, 0)
    game_world.add_object(boy, 1)
    game_world.add_object(boy1, 1)
    global Monster
Beispiel #11
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)
    boy.set_background(background)

    global balls
    balls = [Ball() for i in range(100)]
    game_world.add_objects(balls, 1)
Beispiel #12
0
def enter():
    global boy, ball_list
    ball_list = [BigBall() for i in range(100)]

    boy = Boy()
    game_world.add_object(boy, 1)
    for i in ball_list:
        game_world.add_object(i, 1)
    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)
    boy.set_background(background)
    ball_list[0].set_background(background)
Beispiel #13
0
def create_world():
    global boy, grass, balls, crowns, eventback
    boy = Boy()
    balls = [Ball() for i in range(10)]
    crowns = Crown()
    grass = Grass()
    eventback = EventBackground()
Beispiel #14
0
def enter():
    global boy, grass

    boy = Boy()
    grass = Grass()
    game_world.add_object(grass, game_world.layer_bg)
    game_world.add_object(boy, game_world.layer_player)
Beispiel #15
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    for i in range(100):
        ball = Ball()
        game_world.add_object(ball, 1)
        ball.set_center_object(boy)

    background.set_center_object(boy)
    boy.set_background(background)
Beispiel #16
0
def create_world():
    global boy, grass, balls, big_balls
    boy = Boy()
    big_balls = [BigBall() for i in range(10)]
    balls = [Ball() for i in range(10)]
    balls = big_balls + balls
    grass = Grass()
Beispiel #17
0
def create_world():
    global boy, background
    boy = Boy()
    background = Background()

    background.set_center_object(boy)
    boy.set_background(background)
Beispiel #18
0
def enter():
    global boy
    global Die
    boy = Boy()
    grass = Grass()
    game_world.add_object(grass, 0)
    game_world.add_object(boy, 1)
Beispiel #19
0
def main():
	randomInputGenerate()
	BoyCsv = open('./boys.csv')
	GirlCsv = open('./girls.csv')
	Boys = csv.reader(BoyCsv,delimiter = ",")
	Girls = csv.reader(GirlCsv,delimiter = ",")
	Blist = []
	Glist = []
	for row in Boys:
		Blist += [Boy(row[0],int(row[1]),int(row[2]),row[3],int(row[4]),int(row[5]))]
	BoyCsv.close()
	
	for row in Girls:
		Glist += [Girl(row[0],int(row[1]),int(row[2]),row[3],int(row[4]))]
	GirlCsv.close()


	logging.info('Started pairing up')
	for g in Glist:
		for b in Blist:
			logging.info('Girl '+g.name+' is checking on '+b.name)
			if (b.isEligible(g.maintainanceBudget,g.attractiveness)) and (g.isEligible(b.budget)) and (b.status == 'single') and (g.status == 'single'):
				b.status = 'commited'
				g.status = 'commited'
				b.gf = g.name
				g.bf = b.name
				logging.info(g.name+' is commited to '+b.name)
				break
	
	for g in Glist:
		if(g.status == 'single'):
			print(g.name+' is single')
		else:
			print(g.name+' is commited to '+g.bf)
Beispiel #20
0
def create_new_world():
    global boy, zombies
    boy = Boy()
    zombies = [Zombie() for i in range(100)]

    game_world.add_object(boy, 1)
    game_world.add_objects(zombies, 1)
Beispiel #21
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    ground = Ground()
    game_world.add_object(ground, 0)
Beispiel #22
0
def create_world():
    global boy, background, zombies, lizards, octopuses, hearts
    boy = Boy()
    background = Background(600, 600)
    hearts = [Heart() for i in range(5)]
    zombies = [Zombie() for i in range(4)]
    lizards = [Lizard() for i in range(4)]
    octopuses = [Octopus() for i in range(4)]
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)
Beispiel #24
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global balls
    balls = [Ball() for i in range(ball_num)]
    game_world.add_objects(balls, 1)

    background.set_center_object(boy)  #상호참조
    boy.set_background(background)
    for i in range(ball_num):
        balls[i].set_background(background)
def enter():
    global boy
    boy = Boy()
    grass = Grass()
    bird = Bird()
    game_world.add_object(grass, 0)
    game_world.add_object(boy, 1)
    game_world.add_object(bird, 1)
Beispiel #26
0
def enter():
    global boy, grass, fire
    boy = Boy()
    grass = Grass()
    fire = Ball()
    game_world.add_object(grass, 0)
    game_world.add_object(boy, 1)
    game_world.add_object(fire, 1)
Beispiel #27
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global grass
    grass = Grass()
    game_world.add_object(grass, 0)
Beispiel #28
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global balls
    balls = [FixedBall() for i in range(100)]
    game_world.add_objects(balls, 1)

    background.set_center_object(boy)  # 백그라운드에 boy를 알려줌
    boy.set_background(background)  # boy에 백그라운드를 알려줌

    for ball in balls:
        ball.set_background(background)
Beispiel #29
0
 def __init__(self):
     super(Game,self).__init__()
     self.scene=Scene()
     self.view=View()
     generate_level(self.scene,3000,0.5)
     self.boy=Boy()
     self.boy.set_position(32,300)
     self.scene.add(self.boy)
     self.keys=[]
Beispiel #30
0
def enter():
    global boy, grass, bong, mx, my
    mx, my = 0, 0
    boy = Boy()
    grass = Grass()
    bong = Bong()
    game_world.add_object(grass, game_world.layer_bg)
    game_world.add_object(boy, game_world.layer_player)
    game_world.add_object(bong, game_world.layer_obstacle)
Beispiel #31
0
def enter():
    global Sound2
    Sound2 = load_wav('pickup.wav')
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global ba
    ba = [Ball() for i in range(100)]

    game_world.add_objects(ba, 1)

    background.set_center_object(boy)
    boy.set_background(background)
Beispiel #32
0
class Game(Application):
    def __init__(self):
        super(Game,self).__init__()
        self.scene=Scene()
        self.view=View()
        generate_level(self.scene,3000,0.5)
        self.boy=Boy()
        self.boy.set_position(32,300)
        self.scene.add(self.boy)
        self.keys=[]

    def loop(self,dt):
        #dt=0.033
        self.scene.advance(dt)
        vy=self.view.get_position().y
        self.view.set_position(vector2(self.boy.get_position().x-300,vy))
        self.draw()
        return True

    def draw(self):
        get_screen().fill((0,0,0))
        self.scene.draw(self.view)
Beispiel #33
0
    def initAgents(self, world):
        self.agentlayer = world.map.getLayer('TechdemoMapGroundObjectLayer')
        world.agentlayer = self.agentlayer
        self.boy = Boy(TDS, world, 'PC:boy', self.agentlayer)
        self.game.instance_to_agent[self.boy.agent.getFifeId()] = self.boy
        self.boy.start()
        self.agent_list.append(self.boy)

        self.girl = Girl(TDS, world, 'PC:girl', self.agentlayer, self)
        self.game.instance_to_agent[self.girl.agent.getFifeId()] = self.girl
        self.girl.start()
        self.agent_list.append(self.girl)

        self.wizard = Wizard(TDS, world, 'PC:wizard', self.agentlayer, self)
        self.game.instance_to_agent[self.wizard.agent.getFifeId()] = self.wizard
        self.wizard.start()
        self.agent_list.append(self.wizard)

        self.beekeepers = create_anonymous_agents(TDS, world, 'beekeeper', self.agentlayer, Beekeeper)
        for beekeeper in self.beekeepers:
            self.game.instance_to_agent[beekeeper.agent.getFifeId()] = beekeeper
            beekeeper.start()
            self.agent_list.append(beekeeper)

        self.cage = Cage(TDS, world, 'sword_crate', self.agentlayer)
        self.game.instance_to_agent[self.cage.agent.getFifeId()] = self.cage
        self.cage.start()
        self.agent_list.append(self.cage)

        self.bees = []
        for i in range(1, 8):
            bee = code.agents.bee.Bee(TDS, world, 'NPC:bee:0{}'.format(i), self.agentlayer, self)
            self.bees.append(bee)
            self.game.instance_to_agent[bee.agent.getFifeId()] = bee
            bee.start()
            self.agent_list.append(bee)

        self.warrior = Warrior(TDS, world, 'PC:warrior', self.agentlayer)
        self.game.instance_to_agent[self.warrior.agent.getFifeId()] = self.warrior
        self.warrior.start()
        self.agent_list.append(self.warrior)

        self.chemist = Chemist(TDS, world, 'NPC:chemist', self.agentlayer)
        self.game.instance_to_agent[self.chemist.agent.getFifeId()] = self.chemist
        self.chemist.start()
        self.agent_list.append(self.chemist)

        self.playableAgent = []
        self.reset()
Beispiel #34
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-  


from boy import Boy

b = Boy()
b.name = 'sssss'
print b.name
# b.name = 'cherry'
print b.age
# b.age = 19
Beispiel #35
0
class AgentManager():

    def __init__(self, world):
        self.player = 0
        self.player_faces = ['gui/images/hud_boy.png', 'gui/images/hud_girl.png', 'gui/images/hud_warrior.png', 'gui/images/hud_wizard.png']
        self.agent_list = []
        self.game = code.game.Game.getGame()

    """
        Intializes all the agents. All these instances are also added to the self.agent_list list
        to simplify the searches by name or id.
    """
    def initAgents(self, world):
        self.agentlayer = world.map.getLayer('TechdemoMapGroundObjectLayer')
        world.agentlayer = self.agentlayer
        self.boy = Boy(TDS, world, 'PC:boy', self.agentlayer)
        self.game.instance_to_agent[self.boy.agent.getFifeId()] = self.boy
        self.boy.start()
        self.agent_list.append(self.boy)

        self.girl = Girl(TDS, world, 'PC:girl', self.agentlayer, self)
        self.game.instance_to_agent[self.girl.agent.getFifeId()] = self.girl
        self.girl.start()
        self.agent_list.append(self.girl)

        self.wizard = Wizard(TDS, world, 'PC:wizard', self.agentlayer, self)
        self.game.instance_to_agent[self.wizard.agent.getFifeId()] = self.wizard
        self.wizard.start()
        self.agent_list.append(self.wizard)

        self.beekeepers = create_anonymous_agents(TDS, world, 'beekeeper', self.agentlayer, Beekeeper)
        for beekeeper in self.beekeepers:
            self.game.instance_to_agent[beekeeper.agent.getFifeId()] = beekeeper
            beekeeper.start()
            self.agent_list.append(beekeeper)

        self.cage = Cage(TDS, world, 'sword_crate', self.agentlayer)
        self.game.instance_to_agent[self.cage.agent.getFifeId()] = self.cage
        self.cage.start()
        self.agent_list.append(self.cage)

        self.bees = []
        for i in range(1, 8):
            bee = code.agents.bee.Bee(TDS, world, 'NPC:bee:0{}'.format(i), self.agentlayer, self)
            self.bees.append(bee)
            self.game.instance_to_agent[bee.agent.getFifeId()] = bee
            bee.start()
            self.agent_list.append(bee)

        self.warrior = Warrior(TDS, world, 'PC:warrior', self.agentlayer)
        self.game.instance_to_agent[self.warrior.agent.getFifeId()] = self.warrior
        self.warrior.start()
        self.agent_list.append(self.warrior)

        self.chemist = Chemist(TDS, world, 'NPC:chemist', self.agentlayer)
        self.game.instance_to_agent[self.chemist.agent.getFifeId()] = self.chemist
        self.chemist.start()
        self.agent_list.append(self.chemist)

        self.playableAgent = []
        self.reset()

    """
        This method checks if the first 3 bees are near the beeboxes.
    """
    def beesAtHome(self):
        for bee in self.bees:
            if int(bee.agentName[-2:]) <= 3 and bee.mode == code.agents.bee._MODE_WILD:
                return False
        return True

    """
        This method checks if the bees whith id >= 4 are all dead.
    """
    def beesDead(self):
        for bee in self.bees:
            if int(bee.agentName[-2:]) >= 4 and bee.mode != code.agents.bee._MODE_DEAD:
                return False
        return True

    def reset(self):
        for p in self.playableAgent:
            p.reset()
        self.playableAgent = [self.boy, self.girl]
        self.active_agent = self.boy


    """
        Returns the current active agent.
    """
    def getActiveAgent(self):
        return self.active_agent

    """
        Returns the FIFE instance of the current active agent.
    """
    def getActiveInstance(self):
        return self.active_agent.agent

    """
        Returns the current active agent's location.
    """
    def getActiveAgentLocation(self):
        return self.active_agent.agent.getLocation()

    def getHero(self):
        return self.active_agent

    def getGirl(self):
        return self.girl

    """
        Changes the current active agent. The list self.playableAgent contains all the
        currently playable characters.
    """
    def toggleAgent(self, world, face_button):
        self.player = (self.player + 1) % len(self.playableAgent)

        face_button.up_image = self.player_faces[self.player]
        face_button.down_image = self.player_faces[self.player]
        face_button.hover_image = self.player_faces[self.player]

        for i in range(len(self.playableAgent)):
            self.playableAgent[i].idle()
            if i == self.player:
                self.playableAgent[i].isActive = True
                world.cameras['main'].attach(self.playableAgent[i].agent)
                world.cameras['small'].attach(self.girl.agent)
                self.active_agent = self.playableAgent[i]
            else:
                self.playableAgent[i].isActive = False
                self.playableAgent[i].follow_hero()

    """
        Returns the Agent to the agent with a specific fifeId.
    """
    def getAgentFromId(self, fifeId):
        for ag in self.agent_list:
            if ag.agent.getFifeId() == fifeId:
                return ag
        return None

    """
        Returns the Agent to the agent with a specific name.
    """
    def getAgentByName(self, name):
        for ag in self.agent_list:
            if ag.agentName == name:
                return ag
        return None

    """
        Adds a new playable agent if it's not yet present inside the playableAgent list.
    """
    def addNewPlayableAgent(self, name):
        for a in self.playableAgent:
            if a.agentName == name:
                return
        for a in self.agent_list:
            if a.agentName == name:
                self.playableAgent.append(a)
                if a.agentName != self.active_agent.agentName:
                    a.follow_hero()

    def destroy(self):
        for a in self.agent_list:
            a.destroy()