Exemple #1
0
def main():
    """
    Main function
    """
    system = SolarSystem(3600, 11.5517 * 10**3, Options.PROBE_RUN,
                         "CelestialObjects")
    animate = Animation(system)
    animate.plot()
Exemple #2
0
    def __init__(self, damage, w_type, sprite_sheets):

        super().__init__()

        self.idle = Animation(sprite_sheets[0], 128, 8, 1)
        self.attack = Animation(sprite_sheets[1], 128, 8, 4)
        self.block = Animation(sprite_sheets[2], 128, 8, 1)
        self.state = "idle"
        self.count = 0

        self.image = self.idle.images[0]
        self.mask = pygame.mask.from_surface(self.image)
        self.image_original = self.idle.images[0]
        self.rect = self.image.get_rect()

        self.damage = damage
        self.type = w_type
Exemple #3
0
 def test_plot_show(self, mock):
     """Test to prove that plt.show is called in plot() method.
     Uses mocking
     """
     self.system_probe = SolarSystem(3600, 10000, Options.PROBE_RUN,
                                     "CelestialObjects")
     animate = Animation(self.system_probe)
     animate.plot()
     mock.assert_called()
Exemple #4
0
 def test_scatterplot_show(self, mock):
     """Test used to prove that plt.show() is called once in scatter_plot method
     uses mocking
     """
     self.system_probe = SolarSystem(3600, 10000, Options.PROBE_RUN,
                                     "CelestialObjects")
     animate = Animation(self.system_probe)
     animate.scatter_plot(100)
     mock.assert_called_once()
Exemple #5
0
    def test_plot_animate(self, mock, mock2):
        """Test used to check that a FunCAnimator is used in plot()
        Uses mocking

        """
        mock.return_value = None
        self.system_probe = SolarSystem(3600, 10000, Options.PROBE_RUN,
                                        "CelestialObjects")
        animate = Animation(self.system_probe)
        animate.plot()
        mock.assert_called()
Exemple #6
0
 def test_animate_update(self, mock, mock2):
     """Test used to prove that update beeman is calld in the animate method
     Uses mocking.
     """
     self.system_probe = SolarSystem(3600, 10000, Options.PROBE_RUN,
                                     "CelestialObjects")
     animate = Animation(self.system_probe)
     animate.plot()
     animate.init()
     animate.animate(0)
     mock.assert_called()
Exemple #7
0
 def test_scatterplot_update(self, mock, mock2):
     """Test used to prove that update_beeman() is called 100 times in scatter_plot method
     if the parameter passed to scatter_plot is 100.
     uses mocking
     """
     self.system_probe = SolarSystem(3600, 10000, Options.PROBE_RUN,
                                     "CelestialObjects")
     animate = Animation(self.system_probe)
     animate.scatter_plot(100)
     mock.assert_called()
     self.assertEqual(mock.call_count, 100)
Exemple #8
0
    def __init__(self, speed, sprite_sheets, screensize=(1080, 720)):

        super().__init__()

        self.idle = Animation(sprite_sheets[0], 64, 6, 3)
        self.image = self.idle.images[0]
        self.mask = pygame.mask.from_surface(self.image)
        self.image_original = self.idle.images[0]
        self.rect = self.image.get_rect()

        self.speed = speed
        self.time = 0
        self.move = "L"
        self.screensize = screensize
        self.health = 20
        self.dead = False
        self.vulnerability = False
        self.vul_count = 0
Exemple #9
0
    def __init__(self):
        """initialisation of class"""

        super().__init__()

        sprite_sheet = SpriteSheet('character.png')

        self.image = sprite_sheet.get_image(0, 0, 128, 128)
        self.image_original = self.image
        self.mask = pygame.mask.from_surface(self.image)
        self.rect = self.image.get_rect()
        self.rect.x = 540 - self.rect.centerx
        self.rect.y = 360 - self.rect.centery

        self.speed = 5
        self.health = 100
        self.max_health = 100
        self.dead = False
        self.ghost = Animation("ghost.png", 64, 8, 3)
Exemple #10
0
 def setUp(self):
     self.animation = Animation()
     self.animation.n = 2
     self.animation.vmax = 3
     particles = Particles('symulacja', self.animation.n)
     self.animation.simulation = simulation(particles)
     self.animation.simulation.set_velocities(self.animation.n,
                                              self.animation.vmax)
     self.animation.xmax = 30
     self.animation.xmin = 0
     self.animation.ymax = 20
     self.animation.ymin = 0
     self.animation.simulation.set_coordinations(self.animation.n, 1,
                                                 self.animation.xmin,
                                                 self.animation.ymax,
                                                 self.animation.ymin)
     self.animation.simulation.set_boundaries(self.animation.xmax,
                                              self.animation.xmin,
                                              self.animation.ymax,
                                              self.animation.ymin)
        pow = [sprites for sprites in powerup_group if sprites.type == 'kunai']

        if len(pow) < 1:
            powerup_group.add(Kunai_Powerup(random.randint(2000, 4000)))


width = 800

# loading all game animations once to prevent fps drops when creating new instances of any animated class

robot_go = Animation([
    '../assets/enemies/robot/go/go_1.png',
    '../assets/enemies/robot/go/go_2.png',
    '../assets/enemies/robot/go/go_3.png',
    '../assets/enemies/robot/go/go_4.png',
    '../assets/enemies/robot/go/go_5.png',
],
                     0.4,
                     frame_duration=0.4)

robot_die = Animation([
    '../assets/enemies/robot/die/die_1.png',
    '../assets/enemies/robot/die/die_2.png',
    '../assets/enemies/robot/die/die_3.png',
    '../assets/enemies/robot/die/die_4.png',
    '../assets/enemies/robot/die/die_5.png',
    '../assets/enemies/robot/die/die_6.png',
    '../assets/enemies/robot/die/die_7.png',
    '../assets/enemies/robot/die/die_8.png',
    '../assets/enemies/robot/die/die_9.png',
Exemple #12
0
screen = pygame.display.set_mode((800, 500))
pygame.display.set_caption('Katanga Run')
pygame.display.set_icon(pygame.image.load('../assets/tile.png'))
fps = 60

# creating a database instance
db = database.Database()

# Loading player animations for the main menu
player_idle = Animation([
    '../assets/player/idle/Idle__000.png',
    '../assets/player/idle/Idle__001.png',
    '../assets/player/idle/Idle__002.png',
    '../assets/player/idle/Idle__003.png',
    '../assets/player/idle/Idle__004.png',
    '../assets/player/idle/Idle__005.png',
    '../assets/player/idle/Idle__006.png',
    '../assets/player/idle/Idle__007.png',
    '../assets/player/idle/Idle__008.png',
    '../assets/player/idle/Idle__009.png',
],
                        0.4,
                        frame_duration=0.5)

# loading platform image
platform = pygame.image.load('../assets/tile.png')
platform_image = pygame.transform.scale(platform, (100, 80))

# Font packages
main_font = pygame.font.Font('../assets/iomanoid back.ttf', 100)
smaller_font = pygame.font.Font('../assets/iomanoid front.ttf', 50)
smallest_font = pygame.font.Font('../assets/iomanoid front.ttf', 30)