How to use generate_platform method in lisa

Best Python code snippet using lisa_python

PlatformController.py

Source:PlatformController.py Github

copy

Full Screen

...11 self.index = 1012 self.last_x = MAX_JUMP13 self.score = 014 for i in range(0, self.index):15 self.platform_set.append(self.generate_platform(i, self.score))16 17 def generate_platform(self, index, score):18 if(score<MAX_JUMP*MAX_JUMP):19 change = int(math.sqrt(abs(score)))20 else:21 change = MAX_JUMP-122 width = 250 - randrange(change, change+60)23 height = 2024 y = 600 - index * 10025 while True:26 side = bool(getrandbits(1))27 if side:28 x = randrange(self.last_x-MAX_JUMP , self.last_x-change)29 else:30 x = randrange(self.last_x+width+change , self.last_x+MAX_JUMP+width)31 if x >= 0 and x <= SCREEN_WIDTH - width:32 break33 self.last_x = x34 return Platform(x, y, width, height, index)35 def draw(self, game_display, camera):36 for p in self.platform_set:37 p.draw(game_display, camera)38 def collide_set(self, player):39 for i,p in enumerate(self.platform_set):40 player.collide_platform(p,i, self.platform_set)41 # def generate_new_platforms(self, camera):42 # if self.platform_set[-1].y - camera.y > -50:43 # for i in range(self.index,self.index+10):44 # self.platform_set.append(self.generate_platform(i, self.score))45 # self.platform_set.pop(0)46 # self.index += 1047 def generate_new_platforms(self, camera):48 if self.platform_set[-1].y - camera.y > -50:49 self.platform_set.append(self.generate_platform(self.index, self.score))50 self.platform_set.pop(0)...

Full Screen

Full Screen

platform.py

Source:platform.py Github

copy

Full Screen

...3from engine.utils import vector24import random5from block import Block6from ogre import Ogre7def generate_platform(scene,x,y,l):8 for i in range(0,l):9 j=random.randint(6,9)10 if i==0: j=511 if i==(l-1): j=1012 b=Block(1,j)13 b.set_position(x,y)14 x+=3215 scene.add(b)16def generate_level(scene,xlen,difficulty,seed=1):17 random.seed(seed)18 y=41619 generate_platform(scene,0,y,6)20 x=19221 ogre_done=False22 while y>100:23 while x<xlen:24 if random.random()>difficulty:25 l=random.randint(3,7)26 generate_platform(scene,x,y,l)27 if random.random()<(difficulty-0.4):28 ogre_done=True29 monster=Ogre(x,x+l*32-40,50)30 monster.set_position(x+20,y-54)31 scene.add(monster)32 x+=32*(l+2)33 else:34 x+=3235 x=128...

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 lisa 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