예제 #1
0
 def update(self):
     self.counter.run()
     self.count += 1
     if self.counter.expired:
         enemy = Enemy(randint(30, 670), randint(0, 50))
         game_object.add(enemy)
         
         self.counter.reset()
     if self.count > 2000:
         if self.counter.count == 50:
                 enemy = Enemy(randint(30, 670), randint(0, 50))
                 game_object.add(enemy)
예제 #2
0
    def create(self, space, background):
        # p = Platform(space=space, hpos=16, vpos=15, width=8)
        # u = Platform(space=space, hpos=46, vpos=17, width=5)
        # b = BlockPlatform((76, 1), (83, 4), (99, 6), (102, 7), (107, 8), space=space)
        self.add_to_scenery(
            BlockPlatform((0, 0), (12, 7), (17, 5), space=space),
            MovingPlatform(space=space,
                           width=8,
                           initial_position=(18, 7),
                           velocity=(50, 100),
                           path_length=275,
                           group=background),
            BlockPlatform((26, 0), (30, 5), (35, 7), (45, 5), space=space),
            BlockPlatform((30, 14), (34, 17), (46, 19),  space=space),
            BlockPlatform((54, 14), (58, 16), (65, 17), space=space),
            MovingPlatform(space=space,
                           width=4,
                           initial_position=(47, 6),
                           velocity=(0, 100),
                           path_length=125,
                           group=background),
            MovingPlatform(space=space,
                           width=4,
                           initial_position=(56, 7),
                           velocity=(0, 128),
                           path_length=125,
                           group=background),
            MovingPlatform(space=space,
                           width=4,
                           initial_position=(63, 6),
                           velocity=(0, 125),
                           path_length=125,
                           group=background),
            MovingPlatform(space=space,
                           width=4,
                           initial_position=(71, 4),
                           velocity=(0, 100),
                           path_length=125,
                           group=background),
            MovingPlatform(space=space,
                           width=8,
                           initial_position=(80, 2),
                           velocity=(80, 110),
                           path_length=475,
                           group=background),
            Crate(hpos=5, vpos=7, space=space),
            Crate(hpos=5, vpos=8, space=space),
            Crate(hpos=5, vpos=9, space=space),
            Crate(hpos=5, vpos=10, space=space),
            Crate(hpos=5, vpos=11, space=space),
            SceneryDecoration(hpos=5, vpos=7, type=SceneryDecoration.SIGN),

        )
        self.add_to_scenery(*[
            Enemy.guards(i, background, self) for i in list(
                filter(
                    lambda p: isinstance(p, Platform) or isinstance(
                        p, MovingPlatform), self.scenery))
        ])
예제 #3
0
def create_enemy():
    enemy = Enemy(31*16,13*16,"normal")
    game_object.add(enemy)
    enemy1 = Enemy1(3*16,3*16,0,4,4, "normal")
    game_object.add(enemy1)
    enemy12 = Enemy1(220,304,2,0,2, "invisible")
    game_object.add(enemy12)
    enemy12 = Enemy1(368, 272,0,-1, 1, "normal")
    game_object.add(enemy12)
    enemy12 = Enemy1(288, 108, 3, 0, 3, "normal")
    game_object.add(enemy12)
    def setup(self):

        generate_map("image/map/map.json")

        enemy = Enemy(368, 608)
        game_objects.add(enemy)

        enemy1 = Enemy(640, 300)
        game_objects.add(enemy1)

        black_slave = BlackSlave(768, 240)
        game_objects.add(black_slave)

        main_door = MainDoor(16, 320)
        game_objects.add(main_door)

        black_screen = BlackScreen(0, 0)
        game_objects.add(black_screen)

        player = Player(64, 320)
        game_objects.add(player)
예제 #5
0
 def __init__(self, enemyPropertiesFactory, canvas, path):
     Enemy.__init__(self, canvas, path)
     self._enemyPropertiesFactory = enemyPropertiesFactory
예제 #6
0
from player.player_bullet import PlayerBullet
from player.player import Player
from input.input_manager import InputManager
from enemy.enemy import Enemy
import game_objects
from enemy.enemy_spawner import EnemySpawner
# 1. Init pygame
pygame.init()
#  R - G - B (0-255)
GREEN = (0, 255, 0)
# 2. Set up screen
canvas = pygame.display.set_mode((400, 600))

input_manager = InputManager()
player = Player(200, 500, input_manager)
enemy = Enemy(300, 400)
spawner = EnemySpawner()

game_objects.add(player)
game_objects.add(enemy)
game_objects.add(spawner)

clock = pygame.time.Clock()

# 3. Game loop
loop = True
while loop:
    events = pygame.event.get()
    for event in events:
        if event.type == pygame.QUIT:
            loop = False
예제 #7
0
 def update(self):
     self.counter.run()
     if self.counter.expired:
         enemy = Enemy(100, 0)
         game_object.add(enemy)
         self.counter.reset()
예제 #8
0
# 1. init pygame
pygame.init()

# 2. setup screen
size = (1280, 720)
canvas = pygame.display.set_mode(size)
input_manager = InputManager()

hole = Hole(20, 360)
shop = Shop(1200, 360)
player = Player(2, 3, input_manager)
dog_spawner = DogSpawner(25, 25)
# enemy_spawner1 = EnemySpawner(200,300)
# enemy_spawner2 = EnemySpawner(100,100)
enemy = Enemy(500, 500)
game_object.add(player)
game_object.add(hole)
game_object.add(dog_spawner)
# game_object.add(enemy_spawner1)
game_object.add(enemy)
game_object.add(shop)
mouse = Mouse(0, 0)
game_object.add(mouse)

clock = pygame.time.Clock()

loop = True
while loop:
    # loop events
    events = pygame.event.get()