#testcount += 1 #print("Running",testcount) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False keys = pygame.key.get_pressed() #Move player if up, left, or right keys pressed ship.moveplayer(keys, screen, gamearea, map,xoffset*-1) redrawGameWindow(0) #Detect collidion if map.collision(): ship.die(map,xoffset) #Ship collides with the left of the screen if ship.catchscreen(xoffset): ship.die(map,xoffset) #For scrolling #side scrolling if xoffset > 0 - (gamearea["w"] / 2): xoffset -= 1 #xoffset = ship.calculatexoffset(screen,gamearea) #yoffset = ship.calculateyoffset(screen,gamearea) #Detect collision between ship and enemies #If dead then pressing space re-starts game if ship.dead: #Create new instance of ship -overwrite current instance #print(ship.deathpos)