alien-cake-addict example: ensure the cake doesn't spawn on the player (#1713)
fixes #1707 In the game, it makes sense to never spawn the cake on the player.
This commit is contained in:
		
							parent
							
								
									2dd2e5e9fe
								
							
						
					
					
						commit
						94f45586ce
					
				| @ -307,8 +307,15 @@ fn spawn_bonus( | ||||
|             return; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     // ensure bonus doesn't spawn on the player
 | ||||
|     loop { | ||||
|         game.bonus.i = rand::thread_rng().gen_range(0..BOARD_SIZE_I); | ||||
|         game.bonus.j = rand::thread_rng().gen_range(0..BOARD_SIZE_J); | ||||
|         if game.bonus.i != game.player.i || game.bonus.j != game.player.j { | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|     game.bonus.entity = commands | ||||
|         .spawn(( | ||||
|             Transform { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 François
						François