main loop reorganizing
This commit is contained in:
		
							parent
							
								
									b1b585515c
								
							
						
					
					
						commit
						d8ce0f002c
					
				
					 1 changed files with 5 additions and 10 deletions
				
			
		
							
								
								
									
										15
									
								
								pyshoot.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								pyshoot.py
									
									
									
									
									
								
							|  | @ -234,21 +234,16 @@ pygame.display.flip() | ||||||
| globals.moving_objects.add(player) | globals.moving_objects.add(player) | ||||||
| while not globals.die: | while not globals.die: | ||||||
| 	 | 	 | ||||||
| 	# erase player | 	# erase moving objects | ||||||
| 	#globals.screen.blit(background, player.rect, player.rect) |  | ||||||
| 	# draw player |  | ||||||
| 	#globals.screen.blit(player.image, player.pos) |  | ||||||
| 	 |  | ||||||
| 	globals.moving_objects.clear(globals.screen, globals.background) | 	globals.moving_objects.clear(globals.screen, globals.background) | ||||||
| 	globals.bullets_list.clear(globals.screen, globals.background) | 	globals.bullets_list.clear(globals.screen, globals.background) | ||||||
| 
 | 
 | ||||||
| 
 | 	# update game logic | ||||||
| 	# erase moving objects |  | ||||||
| 	globals.moving_objects.update() | 	globals.moving_objects.update() | ||||||
| 	rectlist = globals.moving_objects.draw(globals.screen) |  | ||||||
| 
 |  | ||||||
| 	# bullets handling |  | ||||||
| 	globals.bullets_list.update() | 	globals.bullets_list.update() | ||||||
|  | 
 | ||||||
|  | 	# drawing | ||||||
|  | 	rectlist = globals.moving_objects.draw(globals.screen) | ||||||
| 	rectlist.extend(globals.bullets_list.draw(globals.screen)) | 	rectlist.extend(globals.bullets_list.draw(globals.screen)) | ||||||
| 
 | 
 | ||||||
| 	pygame.display.update(rectlist) | 	pygame.display.update(rectlist) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 kleph
						kleph