예제 #1
0
    def create_enemy(self):
        self.skeleton1 = self.my_view.draw_entity(self.my_view.skeleton,
                                                  self.random_spawn())
        self.chars_on_screen.append(self.skeleton1)
        self.skeleton2 = self.my_view.draw_entity(self.my_view.skeleton,
                                                  self.random_spawn())
        self.chars_on_screen.append(self.skeleton2)
        self.skeleton3 = self.my_view.draw_entity(self.my_view.skeleton,
                                                  self.random_spawn())
        self.chars_on_screen.append(self.skeleton3)
        self.boss = self.my_view.draw_entity(self.my_view.boss,
                                             self.random_spawn())
        self.chars_on_screen.append(self.boss)

        obj = Boss()
        obj.id = self.boss
        self.enemies_on_screen.append(obj)
        self.bossEntity = obj

        obj = Skeleton()
        obj.id = self.skeleton1
        self.enemies_on_screen.append(obj)

        obj = Skeleton()
        obj.id = self.skeleton2
        self.enemies_on_screen.append(obj)

        obj = Skeleton()
        obj.id = self.skeleton3
        self.enemies_on_screen.append(obj)

        print(self.chars_on_screen)
        print(self.skeleton1)
예제 #2
0
 def __init__(self):
     # self.game_status()
     self.my_map = Map()
     self.my_view = View(self.my_map.map1)
     self.combat = Fight_engine()
     self.my_view.root.bind("<KeyPress>", self.on_key_press)
     self.creatures = [Boss(0, 7, "boss")]
     self.get_random_skeletons()
     self.get_units()
     self.hero = Hero(0, 0, "hero-down")
     self.hero.unit_id  = self.my_view.draw_game_object(0, 0, "hero-down")
     self.movement_count = 0
     self.delete_dead_creature()
     self.hud()
     self.my_view.start()
예제 #3
0
    def __init__(self):
        root = Tk()
        canvas_height = 720
        canvas_width = 820
        self.hud_x = 720
        self.hud_y = 0
        self.canvas = Canvas(root, width=canvas_width, height=canvas_height, bg = "#957740")

        self.map = Map()
        self.map.draw_map(self.canvas)

        self.skeleton_number = 3
        self.spots = self.map.create_enemy_spots(self.skeleton_number + 1)
        self.skeletons = []
        self.create_skeletons()
        self.add_skeleton_coordinates()
        self.add_key_to_skeleton()
        self.draw_skeletons()
        
        self.boss = Boss(self.canvas)
        self.boss.draw(self.spots[-1])
        self.boss.x = self.spots[-1][0]
        self.boss.y = self.spots[-1][1]
        self.boss_is_dead = False
        
        self.enemies = []
        self.enlist_enemies()
        self.deleted_enemies = []
        
        self.hero = Hero(self.canvas)
        self.hero.draw(0, 0)
        self.hero_has_key = False
        
        self.hud = Hud()
        self.hud.draw_hud(self.canvas, self.hud_x, self.hud_y, self.hero.level, self.hero.hp, self.hero.dp, self.hero.sp)
        self.enemy_stat_onscreen = False
        self.hero_can_move = True


        root.bind("<KeyPress>", self.on_key_press)
        self.arrows = {
            "up": ["Up", 0, -1], 
            "down": ["Down", 0, 1],
            "right": ["Right", 1, 0],
            "left": ["Left", -1, 0]            
            }
        self.canvas.pack()
        root.mainloop()
예제 #4
0
 def __init__(self):
     self.size = 720
     self.root = Tk()
     self.root.configure(background ='black')
     self.hud = 200
     self.canvas = Canvas(self.root, width=self.size+self.hud, height=self.size,bg="green",bd=0)
     self.floor = PhotoImage(file="floor.png")
     self.wall = PhotoImage(file="wall.png")
     self.char_down = PhotoImage(file="hero-down.png")
     self.char_up = PhotoImage(file="hero-up.png")
     self.char_right = PhotoImage(file="hero-right.png")
     self.char_left = PhotoImage(file="hero-left.png")
     self.skeleton = PhotoImage(file="skeleton.png")
     self.boss = PhotoImage(file="boss.png")
     self.hero = Hero()
     self.warlock = Boss()
     self.bones = Skeleton()
     self.canvas.pack()
     self.canvas.focus_set()
예제 #5
0
파일: game.py 프로젝트: faklijta/Greenfox
 def __init__(self):
     root = Tk()
     canvas_height = 700
     canvas_width = 720
     canvas = Canvas(root, width=canvas_width, height=canvas_height)
     self.map = Map()
     self.map.draw_map(canvas)
     self.hero = Hero(canvas)
     self.hero.draw_hero(0, 0)
     self.hero.update_entity(self.hero.hero_down)
     self.skeleton = Skeleton(canvas)
     self.boss = Boss(canvas)
     self.skel_num = 3
     self.coordinates = self.map.create_random_coordinates(self.skel_num +
                                                           1)
     self.skeleton.draw_skeleton(self.coordinates[:-1])
     self.boss.draw_boss(self.coordinates[-1])
     self.hud = Hud()
     self.hud.draw_hud(canvas, 0, 650)
     root.bind("<KeyPress>", self.on_key_press)
     canvas.pack()
     root.mainloop()