How to use get_level method in Slash

Best Python code snippet using slash

game.py

Source:game.py Github

copy

Full Screen

...62 sys.exit()63 if event.type == self.level_manager.game_complete:64 # Eventually well queue a game over screen with our score #TODO65 # For the remaining projectiles...66 for projectile in self.level_manager.get_level().projectile_group.sprites():67 # stop them from moving to the kill point, so the level never ends68 projectile.vel.x = -.169 if projectile.pos.x < 0 - projectile.WIDTH:70 projectile.pos.x = 0 - projectile.WIDTH71 self.user_interface.show_score = False72 self.user_interface.show_end_screen = True73 self.end_screen = True74 if event.type == pg.KEYDOWN and event.key == pg.K_SPACE and self.end_screen:75 # self.playing = False76 self.end_screen = False77 self.screen = screen78 self.clock = clock79 self.width, self.height = self.screen.get_size()80 self.user_interface = UserInterface()81 self.projectile_manager = Projectile_Manager()82 self.particle_manager = Particle_Manager(screen)83 self.music_manager = Music_Manager()84 self.music_manager.load_music('background')85 self.level_manager = Level_Manager(screen, self.projectile_manager, self.particle_manager,86 self.music_manager)87 self.user_interface.show_score = True88 self.user_interface.show_start_screen = False89 if event.type == pg.USEREVENT + 3:90 self.user_interface.add_point(self.level_manager.get_level().ball_group)91 if event.type == self.level_manager.level_ended:92 self.level_manager.next_level()93 if event.type == pg.KEYDOWN:94 if event.key == pg.K_ESCAPE:95 pg.quit()96 sys.exit()97 # If you are pressing the control key and the level start animation is not playing98 # if event.key == pg.K_q and not self.level_manager.get_level().level_start:99 # self.level_manager.get_level().get_column(1).accelerate()100 # if event.key == pg.K_w and not self.level_manager.get_level().level_start:101 # self.level_manager.get_level().get_column(2).accelerate()102 # if event.key == pg.K_e and not self.level_manager.get_level().level_start:103 # self.level_manager.get_level().get_column(3).accelerate()104 if event.key == pg.K_r and not self.level_manager.get_level().level_start:105 self.level_manager.get_level().get_column(4).accelerate()106 # if event.key == pg.K_c and not self.level_manager.get_level().level_start:107 # self.level_manager.get_level().get_column(5).accelerate()108 if event.key == pg.K_u and not self.level_manager.get_level().level_start:109 self.level_manager.get_level().get_column(6).accelerate()110 # if event.key == pg.K_u and not self.level_manager.get_level().level_start:111 # self.level_manager.get_level().get_column(7).accelerate()112 # if event.key == pg.K_i and not self.level_manager.get_level().level_start:113 # self.level_manager.get_level().get_column(8).accelerate()114 # if event.key == pg.K_o and not self.level_manager.get_level().level_start:115 # self.level_manager.get_level().get_column(9).accelerate()116 # if event.key == pg.K_p and not self.level_manager.get_level().level_start:117 # self.level_manager.get_level().get_column(10).accelerate()118 if event.type == pg.KEYUP:119 if event.key == pg.K_q and not self.level_manager.get_level().level_start:120 self.level_manager.get_level().get_column(1).deccelerate()121 if event.key == pg.K_w and not self.level_manager.get_level().level_start:122 self.level_manager.get_level().get_column(2).deccelerate()123 if event.key == pg.K_e and not self.level_manager.get_level().level_start:124 self.level_manager.get_level().get_column(3).deccelerate()125 if event.key == pg.K_r and not self.level_manager.get_level().level_start:126 self.level_manager.get_level().get_column(4).deccelerate()127 if event.key == pg.K_c and not self.level_manager.get_level().level_start:128 self.level_manager.get_level().get_column(5).deccelerate()129 if event.key == pg.K_u and not self.level_manager.get_level().level_start:130 self.level_manager.get_level().get_column(6).deccelerate()131 if event.key == pg.K_u and not self.level_manager.get_level().level_start:132 self.level_manager.get_level().get_column(7).deccelerate()133 if event.key == pg.K_i and not self.level_manager.get_level().level_start:134 self.level_manager.get_level().get_column(8).deccelerate()135 if event.key == pg.K_o and not self.level_manager.get_level().level_start:136 self.level_manager.get_level().get_column(9).deccelerate()137 if event.key == pg.K_p and not self.level_manager.get_level().level_start:138 self.level_manager.get_level().get_column(10).deccelerate()139 def update(self):140 # Check if the level has ended141 self.level_manager.check_level_state()142 # Update the columns143 self.level_manager.get_level().update_columns()144 # Update the ball145 self.level_manager.get_level().update_balls()146 # Update the projectiles147 self.level_manager.get_level().update_projectiles()148 # Update the particles149 self.particle_manager.update_particles()150 # Update the UI151 self.user_interface.update(self.clock.get_fps(),152 self.level_manager.get_level().ball_group,153 self.level_manager.get_level().columns154 )155 def draw(self):156 # Draw the background, if you dont do this each frame the images you draw157 # to the screen will stack up as copies over one another158 self.screen.fill((0, 0, 0))159 # Draw the background160 self.level_manager.get_level().draw_background()161 # Draw the columns162 self.level_manager.get_level().draw_columns()163 # Draw the projectiles164 self.level_manager.get_level().draw_projectiles()165 # Draw the balls166 self.level_manager.get_level().draw_balls()167 # Draw the particles168 self.particle_manager.draw_particles()169 # Draw the interface170 self.user_interface.draw(self.screen)171 # Updates the entire display at once172 # This is no different than display.update() with no arguments passed in...

Full Screen

Full Screen

test_level_selector.py

Source:test_level_selector.py Github

copy

Full Screen

...31>>> b.get_current()32(7, False)33>>> #######################################################34>>> s = LevelSelector([10*i for i in range(10)]) #[0..90], target = 40 35>>> s.get_level()365037>>> s.update_level_result(True)38>>> s.get_level()398040>>> s.update_level_result(False)41>>> s.get_level()427043>>> s.update_level_result(False)44>>> s.get_level()456046>>> s.update_level_result(False)47>>> s.get_level()485049>>> s.update_level_result(False)50>>> s.get_level()514052>>> s.update_level_result(True)53154>>> #######################################################55>>> s = LevelSelector([10*i for i in range(10)]) #[0..90], target = 9056>>> s.get_level()575058>>> s.update_level_result(True)59>>> s.get_level()608061>>> s.update_level_result(True)62>>> s.get_level()639064>>> s.update_level_result(True)65166>>> #######################################################67>>> s = LevelSelector([10*i for i in range(10)]) #[0..90], target = -168>>> s.get_level()695070>>> s.update_level_result(False)71>>> s.get_level()722073>>> s.update_level_result(False)74>>> s.get_level()751076>>> s.update_level_result(False)77>>> s.get_level()78>>> s.update_level_result(False)79280>>> #######################################################81>>> s = LevelSelector([10*i for i in range(10)]) #[0..90], target = -182>>> s.get_level()835084>>> s.update_level_result(False)85>>> s.get_level()862087>>> s.update_level_result(True)88>>> s.get_level()894090>>> s.update_level_result(False)91>>> s.get_level()923093>>> s.update_level_result(False)94>>> s.get_level()952096>>> s.update_level_result(False)97>>> s.get_level()981099>>> s.update_level_result(False)100>>> s.get_level()101>>> s.update_level_result(False)1022103>>> #######################################################104>>> s = LevelSelector([10*i for i in range(9)]) #[0..80], target = 70105>>> s.get_level()10640107>>> s.update_level_result(True)108>>> s.get_level()10970110>>> s.update_level_result(True)111>>> s.get_level()11280113>>> s.update_level_result(False)114>>> s.get_level()11570116>>> s.update_level_result(True)1171118"""119def run():120 import doctest, sys121 res = doctest.testmod(sys.modules[__name__])122 if res.failed == 0:123 print("All tests succeeded!")124if __name__ == '__main__':...

Full Screen

Full Screen

advancements_test.py

Source:advancements_test.py Github

copy

Full Screen

1import unittest2from main.model.character.utility.helper_modules.advancements import get_level, get_min_exp, get_proficiency_bonus3class AdvancementsTest(unittest.TestCase):4 def test_get_level(self):5 # TODO: test every level?6 # Level 17 self.assertEqual(get_level(0), 1)8 self.assertEqual(get_level(200), 1)9 self.assertEqual(get_level(299), 1)10 # Level 211 self.assertEqual(get_level(300), 2)12 self.assertEqual(get_level(432), 2)13 self.assertEqual(get_level(899), 2)14 # Level 715 self.assertEqual(get_level(23000), 7)16 self.assertEqual(get_level(26000), 7)17 self.assertEqual(get_level(33999), 7)18 # Level 1519 self.assertEqual(get_level(165000), 15)20 self.assertEqual(get_level(165001), 15)21 self.assertEqual(get_level(170370), 15)22 self.assertEqual(get_level(190000), 15)23 self.assertEqual(get_level(194999), 15)24 # Level 2025 self.assertEqual(get_level(355000), 20)26 self.assertEqual(get_level(355001), 20)27 self.assertEqual(get_level(400000), 20)28 self.assertEqual(get_level(999999), 20)29 self.assertEqual(get_level(45235345564565), 20)30 def test_get_min_exp(self):31 self.assertEqual(get_min_exp(1), 0)32 self.assertEqual(get_min_exp(4), 2700)33 self.assertEqual(get_min_exp(14), 140000)34 def test_get_proficiency_bonus(self):35 # PB 236 self.assertEqual(get_proficiency_bonus(1), 2)37 self.assertEqual(get_proficiency_bonus(2), 2)38 self.assertEqual(get_proficiency_bonus(3), 2)39 self.assertEqual(get_proficiency_bonus(4), 2)40 # PB 341 self.assertEqual(get_proficiency_bonus(5), 3)42 self.assertEqual(get_proficiency_bonus(6), 3)43 self.assertEqual(get_proficiency_bonus(7), 3)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful