Esempio n. 1
0
	def Menu(self):
		cont = logic.getCurrentController()
		obj = cont.owner
		scene = logic.getCurrentScene()
		mouse = cont.sensors['Mouse']
		mouseEvents = logic.mouse.events
		click = mouseEvents[events.LEFTMOUSE]
		if obj['time'] > 3:
			if click:
				logic.restartGame()
		obj['time'] += 1
Esempio n. 2
0
 def Menu(self):
     cont = logic.getCurrentController()
     obj = cont.owner
     scene = logic.getCurrentScene()
     mouse = cont.sensors['Mouse']
     mouseEvents = logic.mouse.events
     click = mouseEvents[events.LEFTMOUSE]
     if obj['time'] > 3:
         if click:
             logic.restartGame()
     obj['time'] += 1
Esempio n. 3
0
 def hurting(self):
     keyPressed = strategyKey.keyTouch
     self.health = self.arm.children[0]["healt"] 
     #self.health = self["healt"]
     
     if keyPressed(events.HKEY):
         #self.health = self.health - 50.0
         print(self.health)  
         
     if(self.health<0):
         #passp
         logic.restartGame()
Esempio n. 4
0
def main():
    """Main Game Loop"""
    global velocity
    # if user is pressing the Key make bird flap faster else fall down slowly
    if keyboard.events[146] is 1 or keyboard.events[32] is 1:  # UP or SPACEBAR
        velocity, bird['frame'] = 0.25, 0
    else:
        bird['frame'] += 1
        bird.worldPosition[2] += velocity
        velocity -= 0.02
    # Make new obstacles else move the existing obstacles and increase score
    if current_distance > next_obstacle:
        make_more_obstacles()
    else:
        scroll_the_obstacles()
        bird['rot'] = rotate_the_bird()
        score = getCurrentScene().objects['score']['Text'] = calculate_score()
    # if is dead restart as game over else clean obstacles out of camera view
    if is_dead():
        restartGame()
    else:
        clear_the_obstacles()
Esempio n. 5
0
def endGame(health):
    if health < 0:
        logic.restartGame()